Avatar of Kaprice
Flag for United States of America asked on

Regasm error - RA0000: Unable to locate input assembly or one of its dependencies

I created a Solution in Visual Studio 2013 and in that solution, I added an existing open source project and then added my own project to reference the methods in the open source one.

More specifically, the open source project writes and merges PDF files.

But, since I need that functionality in MS Access VBA, I could not compile that PDF project, directly.

So, I added a second project as a wrapper, which simply calls the needed methods from the other project.

I then compiled the solution as a COM and selected Make Assembly Com visible.

I was then able to create a Reference in MS Access VBA module and run that code.

BUT, when I tried to install my Access file and DLLs from the VS Solution on a Production computer, it didn't work. Apparently, the DLLs need to be registered, which happens automatically on the Dev machine.

From my Googling, it appears I need to run Regasm.exe.

I've attached to screenshots. One is a directory listing of the Build output from Visual Studio. The other is of the various attempts at running regasm and the resulting errors.

.NET ProgrammingVisual Basic.NETVBA

Avatar of undefined
Last Comment

8/22/2022 - Mon
Robert Schutt

1) I suspect (from some googling as well) that you only need to register your own (stub) dll, not the PdfSharp dll, that just needs to be in the same folder as the rest.

2) The error 'Unable to locate' seems dead on to me, none of those lines specify a dll that is present in that place, what does "U:cd\" mean? You can also try doing it the other way around: go to your app folder and run regasm from there by specifying its full path:

U:\YourAppFolder>c:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe <...options...> PdfSharpStub.dll <...options...>

Open in new window

Then still there are some possible problems but let's see what regasm reports once it can actually read the dll file.

Robert, thanks for the response.

I AM only trying to register the Stub (though possibly in the screenshot I may have tried the other just to see what it would do. But, when I do the stub, I still get that error.

I don't know what the U: does. I saw it in a Google response and gave it a try.  I think it was claimed to be a switch for changing to a directory.

I put the Build output in System32, where the path should not matter, from what I've read. I also tried having it in the application folder and using the path in the regasm.

I'll try your other suggestion of calling regasm from the app folder.

Any other thoughts?
Robert Schutt

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Yeah, I based that System32 path thought on this tutorial:


Thanks for sticking with me. I'll go try your suggestion, now, and report back.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck


I tried it on a different computer because the original production computer wan't available. Here's what I did differently, and I can't be sure which change (or all) made the difference:

* copied the Build output to the application folder (not System32).

*  ran cmd.exe as Admin.

* Changed directory to the application folder

* ran regasm with a fully specified path to the regasm.exe file.

It worked! Thank  you so very much!!

VERY much appreciated.
Robert Schutt


Well yes, reading back I guess when I said make the application folder your current directory, I assumed you had already copied the build output there even though you had not mentioned that.

In general, when I make a separate dll which is needed for only 1 application on a computer I like to keep it with the application, although once it is registered, there is nothing stopping other applications from referencing and using it.

So putting the dll(s) in a folder of their own and registering them in that folder can be a valid option, you can even make a separate installer for it, if you're planning on distributing them.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

I couldn't figure out how to make an installer that would do the regasm (or equivalent). Any ideas?

I don't have a third party installer, just the one that VS 2013 supports (Limited InstallShield).
Robert Schutt

I have actually only ever user an old version of InstallShield (with non .NET dll) but as I recall the whole idea is that you don't have to do the heavy lifting yourself. When you include a dll in your installation project it should be a simple option somewhere to have it automatically register on the target machine.

However a quick google only leads me to other options like creating a .reg file to be included in the setup project or deploying to the Global Assembly Cache which I'm not sure is a good idea for any and all dll you create (would get crowded there if everybody did that).

One other thing I found is that you do need to be careful to not just add a file to your setup project, add it as an assembly. However, no hands-on experience with that so just echoing what I read as it sounds like something that can easily go wrong.
Robert Schutt

This seems like a pretty extensive description of several options: https://www.simple-talk.com/dotnet/visual-studio/build-and-deploy-a-.net-com-assembly/

It actually describes adding the type library  to the setup project. Also describes the property which controls whether the file will be registered.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.

Thanks so much. You're a lifesaver.