Click here to Skip to main content
15,892,298 members
Articles / Programming Languages / C#

DLL must exist in same folder as executible

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
5 Nov 2012CPOL 0  
Yes, you may need some library assemblies in a different folder. For example, you need it if you have some different applications using shared libraries and you don't want to mix them together or put anything in GAC. Here is one of the methods based on application config file:Let's assume...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
7 Nov 2012onelopez
You could also use this event to figure out where to load your dll from:AppDomain.CurrentDomain.AssemblyResolveFrom time to time, I'd like to work with third party dlls and I embed them in the executable to create a standalone executable that could just work anywhere. Using this event...
Please Sign up or sign in to vote.
5 Nov 2012stevenandler 4 alternatives  
I just created my first DLL using C# in MS Visual Studio 2010. My executible was also created in C# and everything works fine. The only issue I am having is, my program only runs if the DLL is in the same folder. Please tell me what I need to change in either my program or dll so I will be able...
Please Sign up or sign in to vote.
5 Nov 2012fjdiewornncalwe
With dotNet, you'll want to have the assembly in one of two places, either the Global Assembly Cache (GAC), or in the same directory with your application.The only reason for an assembly to be placed in the GAC is if your assembly is going to be used by multiple different applications. You...
Please Sign up or sign in to vote.
5 Nov 2012Leonardo Paneque
In that case you must register the DLL in the GAC (Global Assembly Cache)like this:gacutil /i mydll.dllOpen a visual studio console(as admin) and run the gacutil.exe utility.see more details here:http://msdn.microsoft.com/en-us/library/ex0ss12c(v=vs.80).aspx[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
United States United States
Physics, physical and quantum optics, mathematics, computer science, control systems for manufacturing, diagnostics, testing, and research, theory of music, musical instruments… Contact me: https://www.SAKryukov.org

Comments and Discussions