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.



regasm-files.png
regasm.png
KapriceAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Robert SchuttSoftware EngineerCommented:
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.
KapriceAuthor Commented:
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 SchuttSoftware EngineerCommented:
Putting a dll in the system32 folder will make it available to be loaded from an application because that folder is always in the global PATH variable. It will normally not make it available to be opened for reading by just any program but loading by regasm may be a special case although if you have tried it I would say it is not.

So running regasm with full path while having the application folder as your current directory would still be my best bet.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

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

http://www.geeksengine.com/article/create-dll.html

Thanks for sticking with me. I'll go try your suggestion, now, and report back.
KapriceAuthor Commented:
Success!

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!!
KapriceAuthor Commented:
VERY much appreciated.
Robert SchuttSoftware EngineerCommented:
Cool!

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.
KapriceAuthor Commented:
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 SchuttSoftware EngineerCommented:
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 SchuttSoftware EngineerCommented:
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.
KapriceAuthor Commented:
Thanks so much. You're a lifesaver.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.