When setting Register For Com interop
I’ve found that you do need to run as Administrator.
Without Administrator trying to compile I got errors like:
Cannot register assembly “C:\TFS\Project\Src\ProjectAddin\bin\Debug
\ProjectAddin.dll” – access denied. Please make sure you’re running
the application as administrator. Access to the registry key
‘HKEY_CLASSES_ROOT\CLSID{3A6192EA-3C9C-39EB-99A3-3DBFF8CA118F}’ is
denied.
The above registry key didn’t exist so I created it, then trying to compile I got:
Cannot register type library
“C:\TFS\Project\Src\ProjectAddin\bin\Debug \ProjectAddin.tlb”. Error
accessing the OLE registry. (Exception from HRESULT: 0x8002801C
(TYPE_E_REGISTRYACCESS))
Solution
Turn off Register for COM interop and the error goes away, or the better solution:
Shift + Right click Visual Studio and open as Administrator, open the project. Tick Register for Com interop and it compiles successfully.