First, the question is similar to Deploying .NET COM dll, getting error (0x80070002) but it didn't answer my problem.
I have build a dll (.net4) that I use with VBA in Excel / Word.
Principle:
I register the dll with regasm.exe from a temporary folder (no problem)
RegAsm.exe `C:\temp\install\mydll.dll` /codebase
When Excel / Word load, the document (excel or word) load the dll in references
Call ThisWorkbook.VBProject.References.AddFromFile("C:\working\anyfolder\mydll.tlb")
The folderpath can change depending the user (he create documents where he wants), and he can send documents to other users (if the dll is not in the folder, the document works in a degraded mode.
All of this works fine.
My problem: Recently I decided to improve the installation of this dll. When the installation finish I add a clean of the installation folder (C:\temp\install). But after doing that, when I try to use my dll in Excel / Word I have the error 0x80070002 File not found
, even if the dll is in the folder of use (it's the same version of the dll I register)
What I know: I understood that he want the dll in the installation folder.
What I want:
- Is there a way, after registration with regasm, to delete dll from installation folder and only use the one in the folder of documents (and move the dll from folder to folder depending needs).
- Should I take a look at the GAC ? (I read the GAC wasn't needed if the dll is in the same folder as the document)
I read regasm documentation but found no information about it
If any other information is needed to anwser this, don't hesitate to ask.
Thanks a lot
update
To solve my problem, during the installation I add an installation to the GAC
(new Publish()).GacInstall("C:\temp\install\mydll.dll")
Publish needs a reference to System.EnterpriseServices