Sep 19 2019 01:07 PM
Hello there
Is it possible to implement an IRtdServer interface for use by Excel in a .Net core project?
I have an existing .Net 4.6.1 framework project which I am looking to upgrade to .Net Core 3. I am using Visual Studio 2019 Preview, version 3.0.100 preview9 of the .Net Core 3 SDK, and C#.
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
{
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. I have ported the application to .Net core, but have been unable to get it to work.
Running RegAsm 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 attempted to register the DLL:
regsvr32 "C:\Projects\DEC Decision Capital\ARTHyperion\AmeritradeRtdCore\bin\Debug\netcoreapp3.0\AmeritradeRtdCore.comhost.dll"
This gives three different results on three different PCs:
1)
2)
No error is displayed, but the registration doesn’t work.
3)
The registration succeeds, however the underlying issue remains, i.e. I can’t get Excel to communicate with it.
Any help greatly appreciated.
Geoff Olding