COM support in .NET 5
marcbarry opened this issue · 3 comments
.NET core 3.1 projects can reference COM components i.e. <COMReference Include="NetFwTypeLib.dll" />
which compiles and debugs from Visual Studio.
However, attempting to dotnet publish
such projects with COMReference
directives fails with the message, error : MSB4803: The task "ResolveComReference" is not supported on the .NET Core version of MSBuild. Please use the .NET Framework version of MSBuild
.
As far as I can tell, as of .NET core 3.1 applications can still access COM objects provided calling code is compiled at version 4.6.2
of the .NET Framework and referenced into the .NET core 3.1 project.
I'm not sure if this will continue to be possible with .NET 5?
I've searched github issues but not found a definitive answer regarding the level of support .NET 5 will have for publishing projects that need access to COM components. Could anybody help shed some light on the current plans please?
See also dotnet/core-setup#4577, dotnet/sdk#2814 and #10589
Thanks
I couldn't figure out the best area label to add to this issue. Please help me learn by adding exactly one area label.
@marcbarry COM will have at least the same level of support in .NET 5 as it does in .NET 3.1.
The SDK issue with the publish
command is related to the implementation of COMReference
item processing which is built on top of some .NET Framework's TLB APIs - which are not supported in .NET 3.0+. These TLB APIs are not slated to be brought back, but consumption of TLB is still supported. This means the runtime can consume a TLB or a PIA from a TLB, but it cannot produce a TLB for an assembly or create a PIA from a TLB. Using the .NET Framework's TlbImp manually should be supported and if that doesn't work please file issues. The use of .NET Framework's TlbExp is however not supported at all and there is no planned support for that tool.
Thanks guys, just what I was looking for.
Edit: adding a link for future reference: how to generate primary interop assemblies using tlbimp.