none
Compiling an IRtdServer Interface for Excel RTD() Function in .Net Core RRS feed

  • Question

  • Hello there

    Is it possible to implement an IRtdServer interface for use by Excel in a .Net core project?  I am using Visual Studio 2019 Preview, version 3.0.100 preview9 of the .Net Core 3 SDK, and C#.

    I have an existing .Net 4.6.1 framework project which I am looking to upgrade to .Net Core 3.

    The heart of this project is a class to communicate with Excel using Excel’s RTD function:

    [Guid("2B70D74D-A4F6-485F-8CDF-4CE514E75183")]

        [ProgId("Ameritrade.RTD")]

        [ComVisible(true)]

        public class RtdQuoteServer : IRtdServer

        {

    I have been unable to get this to work in .Net core as I have been unable to create a COM interface to it.

    To create the interface for the.Net Framework project, I use the following:

    %SystemRoot%\Microsoft.Net\Framework64\v4.0.30319\RegAsm.exe %~dp0\AmeritradeRtd\bin\Debug\AmeritradeRtd.dll /codebase

    This works fine for the .Net framework version, but running it against the .Net core dll generates the following error:

    regasm: error RA0000 : could not load file or assembly System.Runtime, version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.  The system cannot find the file specified.

    I found this article, indicating that creating COM components is now supported in .Net Core 3.0 - https://docs.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com

    I have followed these instructions as far as I was able:

        [ComVisible(true)]

        [Guid("7B707A4B-594F-4F85-A099-94C473FC7A43")]

        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]

        public interface IPointLessInterface

        {

            public void PointlessFunction();

        }

     

        [Guid("7B707A4B-594F-4F85-A099-94C473FC7A43")]

        [ProgId("AmeritradeCore.RTD")]

        [ComVisible(true)]

        public class RtdQuoteServer : IRtdServer, IPointLessInterface

        {

            public void PointlessFunction() { }

     

    I attempted to register the DLL:

    regsvr32 "C:\Projects\DEC Decision Capital\ARTHyperion\AmeritradeRtdCore\bin\Debug\netcoreapp3.0\AmeritradeRtdCore.dll"

    This generates the following error:

    The module “c:\projects\ARTHyperion\AmeritradeRtdCore\bin\Debug\netcoreapp3.0\AmeritradeRtdCore.dll” was loaded but the entry-point DllRegisterServer was not found.

    Any help greatly appreciated.

    Geoff Olding


    Tuesday, September 17, 2019 10:05 PM

All replies

  • In fact I was attempting to register the wrong DLL.  I have now successfully run regsvr32 on AmeritradeRtdCore.comhost.dll.  However, this hasn’t addressed the underlying issue, i.e. the server side code is still not being called by Excel.
    Thursday, September 19, 2019 6:16 PM