How to register class library create with .NET 6.0?

aluzi liu 486 Reputation points
2022-08-18T09:12:40.47+00:00

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
{count} votes

3 answers

Sort by: Most helpful
  1. Damiano Andresini 171 Reputation points
    2022-08-18T10:26:23.66+00:00
    0 comments No comments

  2. 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 ?


  3. 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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.