I have VS 2015 and want to create a VB.NET DLL to be called from VBA.
When I try to compile and get the DLL, I get "Impossible to write assembly: access denied, make sure you have admin rights" (approximate translation) ==> a compilation error
However, amazingly enough, the DLL does get created, but cannot be linked from VBA.
How can I still do it? I do not have access to admin rights, workspace constraints...
I tried :
https://msdn.microsoft.com/en-us/library/ms973913.aspx ==> the "server" needs admin rights, again...
Directly following the microsoft tutorial ==> "com interop" needs admin rights, as explained above
VB.NET code is dummy, to check the link :
Public Class main
Public Function plus(x#) As Double
plus = x + 1
End Function
End Class
PS: the error:
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4335,5): error MSB3216: Impossible d'inscrire l'assembly "D:\Full_Path\bin\Debug\LibName.dll" - accès refusé. Assurez-vous que vous exécutez l'application en tant qu'administrateur. L'accès à la clé de Registre 'HKEY_CLASSES_ROOT\LibName.main' est refusé.
1>Exécution de la tâche "RegisterAssembly" terminée -- ÉCHEC.
1>Génération de la cible "UnmanagedRegistration" terminée dans le projet "LibName.vbproj" -- ÉCHEC.
translation:
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4335,5): error MSB3216: Impossible to write assembly "D:\Full_Path\bin\Debug\LibName.dll" - access denied. Make sure you run application as administrator. Acces to registry key 'HKEY_CLASSES_ROOT\LibName.main' denied.
Execution of task "RegisterAssembly" finished -- FAIL.
Generation of task "UnmanagedRegistration" finished in project "LibName.vbproj" -- FAIL.