目标:在另一个环境中建立一个C# DLL with COM interop to be called by Delphi。
问题:Windows阻止了我的构建,说我没有编辑注册表的权限。
语境:
[DllExport]
注释我想要导出为Dll的方法。[ComVisible(true)]
作为建议here。Build > Output > Register for COM Interop
编辑并启用了AssemblyInfo.cs
如果我作为管理员运行VS2012我得到这个错误:[assembly: ComVisible(true)]
也许我需要以管理员身份运行Visual Studio。但是,如果我作为管理员运行VS2012,我会得到另一个错误(甚至更随机):Cannot register assembly 'absolute\path\to\NameOf.dll' access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\NameOf.DllClass' is denied
我按照Cannot register assembly. Could not load file or assembly 'RGiesecke.DllExport.Metadata, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ad5f9f4a55b5020b' or one of its dependencies. The system cannot find the file specified.
的步骤,即查找和更改FIX: "Access to the Registry Key Denied" Error Message When You Register .NET Assembly for COM Interop的权限。没运气。
如何获得构建我的DLL并获取HKEY_CLASSES_ROOT\Component Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}
文件所需的权限?
我也有同样的问题。我也没有设法解决你在问题中提到的链接。但我确实有一个解决方法。如果以管理员身份打开Visual Studio,那么一切都有效(至少对我而言)。
我遇到了同样的问题,我能够解决它打开注册表编辑器,转到错误提到的密钥。右键单击并选择“权限...”。我确保我的计算机的所有用户(因为它是工作计算机)具有完全权限。保存,现在它可以正常工作,没有错误。