As mentioned in https://learn.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com in .NETCore you must use Regsvr32.exe.
How to register class library create with .NET 6.0?
I have a class library project create with .NET framework 4.7, and I use RegAsm.exe to register this library.
Recently I upgrade this project to .NET 6.0, and I can not found .net 6.0 version of "RegAsm.exe", so, what can I do?
Developer technologies .NET .NET Runtime
3 answers
Sort by: Most helpful
-
-
Tomasz Prusik 0 Reputation points
2023-07-27T08:41:47.32+00:00 @aluzi liu , I got into the same problem, did you manage to fix it with regsvr32 ?
-
Brian Hong 0 Reputation points
2025-02-19T20:40:14.92+00:00 Actually, if you use the new SDK style project file, then it is very easy to make/register COM.
In short, add
<EnableComHosting>true</EnableComHosting>
to<PropertyGroup>
: this would create [ProjectName].comhost.dll file.
To register do: (/s is to suppress showing dialog)<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="regsvr32 /s $(TargetDir)$(ProjectName).comhost.dll" />
</Target>
Read: https://learn.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com