Home » excel » .net – Problem registering a COM server written for Excel registered on client machine (can't set full path to mscoree.dll)

.net – Problem registering a COM server written for Excel registered on client machine (can't set full path to mscoree.dll)

Posted by: admin March 7, 2020 Leave a comment


In this previous question <How to get COM Server for Excel written in VB.NET installed and registered in Automation Servers list?> there is an example of how to create the full path to a registry key using VS 2008. Everything in the previous answer works correctly except the full path that I am setting (using the registry editor in VS) for mscoree.dll is not working (meaning it seems to do nothing).

The full registry path is:


and the value I am setting is:


I can put anything (including hardcoding the full path) but the setting does not seem to matter and the registry always contains mscoree.dll without any path.

I have tried adding another value to the registry path via VS and that works correctly including having the full path as specified by [SystemFolder].

The reason I need the full path (as explained in the previous question) is that without the path, Excel generates an error when the automation server is selected as it cannot find mscoree.dll (interestingly even though I receive an error the registration works OK).

I am doing the install via a setup project which otherwise works fine.

I am installing on a VISTA*64 system but have gotten the same error on other OS’s.

Does anyone know what I am doing wrong?

How to&Answers:

I didn’t try it but I am guessing it’s related to when VS.NET puts in your registry key “[SystemFolder]mscoree.dll”. It was working in the original post. It might be because VS.NET was running the “regasm /regfile” first and then overwriting that key with “[SystemFolder]mscoree.dll”

In your case, it doesn’t work because VS.NET puts in your registry key “[SystemFolder]mscoree.dll” into the MSI registry table first and then your value got overwritten by the values output from “regasm /regfile”.

In order to rule out the possibility that VS.NET overwriting your value, I think you can mark your DLL vsdrpDoNotRegister. Then, VS.NET won’t do any magic on your registry table. Now, You are all on your own to do the addin registration correctly. However, as the original said, all VS.NET did was simply calling “regasm /regfile”. Why don’t you do it yourself. Once you get the .reg file from “regasm /regfile your.dll”, the only thing you need to do is to import it to the registry table. Right click on the “Registry on Target machine” and click the “Import…” menu. That’s it. It’s not that hard. After you import your reg file, you should see the following key


The value should still be set to mscoree.dll. Now, you can just change it to [SystemFolder]mscoree.dll.