How to make a standalone autocad .net application
<p>I am trying to make an application that a part of it needs some autocad features. So I tried anything in the internet for standalone application, but nothing happen and i always return an error.
(It is not plugin, just open pre-installed autocad and draw something) 
My first try: </p>

<pre><code>AcadApplication gbl_app = new AcadApplication();
AcadDocument gbl_doc = gbl_app.ActiveDocument;
gbl_app.Application.Visible = true;
</code></pre>

<p>And this is error which raise in first line.</p>

<pre><code>An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in SBDesign.exe

Additional information: 
Retrieving the COM class factory for component with CLSID {0D327DA6-B4DF-4842-B833-2CFF84F0948F} 
failed due to the following error: 80040154 
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
</code></pre>

<p>My second try:</p>

<pre><code> AcadApplication acAppComObj = null;
            const string strProgId = "AutoCAD.Application.20";

            // Get a running instance of AutoCAD
            try
            {
                acAppComObj = (AcadApplication)Marshal.GetActiveObject(strProgId);
            }
            catch // An error occurs if no instance is running
            {
                try
                {
                    // Create a new instance of AutoCAD
                    acAppComObj = (AcadApplication)Activator.CreateInstance(Type.GetTypeFromProgID(strProgId), true);
                }
                catch(Exception er)
                {
                    // If an instance of AutoCAD is not created then message and exit
                    System.Windows.Forms.MessageBox.Show("Instance of 'AutoCAD.Application'" +
                                                         " could not be created.");

                    return;
                }
            }

            // Display the application and return the name and version
            acAppComObj.Visible = true;
            System.Windows.Forms.MessageBox.Show("Now running " + acAppComObj.Name +
                                                 " version " + acAppComObj.Version);
</code></pre>

<p>And this is the error:</p>

<pre><code>Unable to cast COM object of type 'System.__ComObject' to interface type 'Autodesk.AutoCAD.Interop.AcadApplication'. 
This operation failed because the QueryInterface call on the COM component for 
the interface with IID '{10E73D12-A037-47E5-8464-9B0716BE3990}' 
failed due to the following error: 
No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
</code></pre>

<p>So really how can i make a standalone application?</p>

<p>Thank you
a.h</p>