Search code examples
.netvb6visual-studio-2019com-interopclass-library

C# Class Library "Make assembly COM-Visible" grey or not available


I want to write a DLL in C# to use in VB6. When I looked it up i found this. Sounds good to me, but i can't check the "Make assembly COM-Visible". I tried different Project types, but the "Assembly Information" button is either not there, or the "Make assembly COM-Visible" is greyed out. Any Ideas?

Im using:

  • Visual Studio 2019 Community
  • .Net Standard 2.0
  • .Net Framework 4.8 SDK

Solution

  • These really is no magic. COM-visible is an attribute you can add yourself:

    https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.comvisibleattribute?view=netstandard-2.0

    Registering your .NET dll can be done yourself as well, you don't need Visual Studio to do that for you:

    https://learn.microsoft.com/en-us/dotnet/framework/tools/regasm-exe-assembly-registration-tool

    If it is a private dll that doesn't need to be shared, you can use the /codebase option instead of putting it in the GAC. The /tlb option can be used to generate the type library that the VB6 IDE will understand.