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

Kaprice
Kaprice used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Robert SchuttSoftware Engineer

Commented:
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.

Author

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?
Software Engineer
Commented:
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.
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Author

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.

Author

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!!

Author

Commented:
VERY much appreciated.
Robert SchuttSoftware Engineer

Commented:
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.

Author

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 Engineer

Commented:
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 Engineer

Commented:
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.

Author

Commented:
Thanks so much. You're a lifesaver.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial