Objective: build a C# DLL with COM interop to be called by Delphi on another environment.
Problem: Windows is blocking my build, saying that I don't have privileges to edit the registry.
Context:
[DllExport]
the methods that I want to export as an Dll.[ComVisible(true)]
as suggested here.Build > Output > Register for COM Interop
AssemblyInfo.cs
and enabled [assembly: ComVisible(true)]
If I run VS2012 not as an admin I get this error: 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
Maybe I need to run Visual Studio as an Administrator. However if I run VS2012 as an admin I get this other error (even more random): 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.
I followed the steps of FIX: "Access to the Registry Key Denied" Error Message When You Register .NET Assembly for COM Interop, namely locating and changing the permissions for HKEY_CLASSES_ROOT\Component Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}
. No luck.
How can I get the privileges needed to build my DLL and get my tlb
file?
I have the same problem. I also didn't manage to get a fix with the link you put in the question. I do however have a work-around. If you open Visual Studio as Administrator, then it all works (for me at least).
I got the same issue and I was able to resolve it opening the Registry Editor, go to the key that the error mentions. Right click and select "permissions...". I made sure that all users for my computer (since it is work computer) had full permissions. Save and now it works with no errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With