<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to properly register COM components from .NET48 to .NET8.0 in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-properly-register-com-components-from-net48-to-net8-0/m-p/13773048#M85635</link>
    <description>&lt;P&gt;C# code should be：&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;string progId = "AutoCADComDemo.Server";
                dynamic server = acadApp.GetInterfaceObject(progId);
                var ret = server.ComputePi();
                Console.WriteLine(ret);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But it doesn't really matter, the general direction is like this.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Aug 2025 01:55:34 GMT</pubDate>
    <dc:creator>18636681122</dc:creator>
    <dc:date>2025-08-19T01:55:34Z</dc:date>
    <item>
      <title>How to properly register COM components from .NET48 to .NET8.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-properly-register-com-components-from-net48-to-net8-0/m-p/13771240#M85628</link>
      <description>&lt;P&gt;This is my .NET4.8 reg method:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;cd &amp;lt;cadPath&amp;gt;
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm &amp;lt;MyNET48Program&amp;gt;.dll /tlb&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in NET8.0 tlb can't be created, so I try a simple com demo:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using System.Runtime.InteropServices;
namespace MyCom;

[ComVisible(true)]
[Guid("4FB4A212-AE3B-4D3B-9262-FC2DE2D11098")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IServer
{
    double Add(double a, double b);
}

[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("MyComApp.Server")]
[Guid("648D8C69-C5B2-45AF-9F22-E6AD2E869B20")]
public class Server : IServer
{
    public double Add(double a, double b) =&amp;gt; a + b;
}&lt;/LI-CODE&gt;&lt;P&gt;.csproj:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;&amp;lt;EnableComHosting&amp;gt;true&amp;lt;/EnableComHosting&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;then I get one `MyCom.comhost.dll` and move all files(include MyCom.dll) to acad.exe path(D:\Software\AutoCAD\AutoCAD 2026)&lt;/P&gt;&lt;P&gt;In this path reg:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;regsvr32 MyCom.comhost.dll&lt;/LI-CODE&gt;&lt;P&gt;MessageBox say reg success!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In VB6.0 I write a test：&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Private Sub Form_Load()
    Dim cad As Variant
    Set cad = CreateObject("AutoCAD.Application.25")
    
    Dim o As Variant
    Set o = cad.GetInterfaceObject("MyComApp.Server")
    
    Dim res As Double
    
    res = o.Add(1.2, 3.4)
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error in "cad.GetInterfaceObject("MyComApp.Server"), com&amp;nbsp;components can't be find, C# has same problems.So how can i do?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 03:16:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-properly-register-com-components-from-net48-to-net8-0/m-p/13771240#M85628</guid>
      <dc:creator>18636681122</dc:creator>
      <dc:date>2025-08-18T03:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly register COM components from .NET48 to .NET8.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-properly-register-com-components-from-net48-to-net8-0/m-p/13772342#M85631</link>
      <description>&lt;P&gt;Have you read this post in Autodesk ADN's "AutoCAD DevBlog":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://adndevblog.typepad.com/autocad/2024/12/bridging-the-net-core-and-autocad-2025-exposing-and-using-com-server-components-with-getinterfaceobject.html" target="_blank" rel="noopener"&gt;https://adndevblog.typepad.com/autocad/2024/12/bridging-the-net-core-and-autocad-2025-exposing-and-using-com-server-components-with-getinterfaceobject.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 15:18:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-properly-register-com-components-from-net48-to-net8-0/m-p/13772342#M85631</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2025-08-18T15:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly register COM components from .NET48 to .NET8.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-properly-register-com-components-from-net48-to-net8-0/m-p/13773046#M85634</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello, thank you for your attention to this issue. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I read this blog post and tried it, but his situation was slightly different from mine; I needed to call the COM component in the exe programme, which is the way of plugins.I registered as the blog post did, using VB6 and C# to find my components and they all failed：&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="visual"&gt;Dim cad As Variant
    Set cad = CreateObject("AutoCAD.Application.25")
    
    Dim o As Variant
    Set o = cad.GetInterfaceObject("AutoCADComDemo.Server")&lt;/LI-CODE&gt;&lt;LI-CODE lang="csharp"&gt;        dynamic acadApp = null;
        try
        {
            Type t = Type.GetTypeFromProgID("AutoCAD.Application.25");
            acadApp = Activator.CreateInstance(t);

            if (acadApp != null) 
            {
                string progId = "MyComApp.Server";
                dynamic server = acadApp.GetInterfaceObject(progId);
                var ret = server.Add(3.1, 4.2);
                Console.WriteLine(ret);
            }

        }
        catch (Exception ex)
        {


        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;I don't know what's wrong, can you help me take a look?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Aug 2025 01:51:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-properly-register-com-components-from-net48-to-net8-0/m-p/13773046#M85634</guid>
      <dc:creator>18636681122</dc:creator>
      <dc:date>2025-08-19T01:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly register COM components from .NET48 to .NET8.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-properly-register-com-components-from-net48-to-net8-0/m-p/13773048#M85635</link>
      <description>&lt;P&gt;C# code should be：&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;string progId = "AutoCADComDemo.Server";
                dynamic server = acadApp.GetInterfaceObject(progId);
                var ret = server.ComputePi();
                Console.WriteLine(ret);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But it doesn't really matter, the general direction is like this.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Aug 2025 01:55:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-properly-register-com-components-from-net48-to-net8-0/m-p/13773048#M85635</guid>
      <dc:creator>18636681122</dc:creator>
      <dc:date>2025-08-19T01:55:34Z</dc:date>
    </item>
  </channel>
</rss>

