我尝试使用 RegAsm.exe 注册 DLL,但收到此错误:
RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.> RegAsm : error RA0000 : Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=...' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
最近我已将我的项目升级到最新的.net8。我已经安装了 ASP.NET Core Runtime 8.0.1 和 .NET Desktop Runtime 8.0.1。
我在我的一个文件中使用“System.Runtime.InteropServices”库。 我可以在依赖框架下看到框架“Microsoft.NETCore.App”下的“System.Runtime”库。 该dll存在于目录“C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\8.0.1 埃夫 et8.0\System.Runtime.dll"
我需要注册此 DLL,以便在本地将其用于需要它的另一个产品。我能做什么?
我想注册该 DLL,以便将其添加到 Computer\HKEY_CLASSES_ROOT 并全局使用该 DLL。 我也尝试使用 GACUTIL,但它需要“强名称”,这可能需要很长时间才能生成。
汉斯·帕桑特提供了链接:
打开提升的命令提示符并运行 regsvr32 ProjectName.comhost.dll。这将向 COM 注册所有公开的 .NET 对象。