user449921
user449921

Reputation: 251

C# creating ".exe" with libraries

I'm using some dlls in my project. To make a '.exe' file i only used 'Released' in Solution Configurations. In my computer exe file works, but in another there's an error: "Can't load file X...". X is a dll file. How can i solve this problem? I copied all dlls into project-bin-realese.

Upvotes: 3

Views: 1372

Answers (3)

David.Chu.ca
David.Chu.ca

Reputation: 38684

The above answers are generic for loading dependency libraries. However, it may also depend on how the exe loading the libraries. For example, MEF has a DI engine to load catalog libraries from a specific folder. If the required libraries are not there, you may get similar exception. Check your .exe requirement for its specific dependencies.

Upvotes: 0

Jesse C. Slicer
Jesse C. Slicer

Reputation: 20157

If you don't need the dependency on the DLL, then right-click it under "References" in your project and remove it. If you do need the dependency, then it will need to go to the other computers with the EXE.

Upvotes: 1

Hans Passant
Hans Passant

Reputation: 942267

Copy the DLLs into the same folder as the EXE. It you put them in a sub directory then you are going to have to use the <probing> element in an app.exe.config file so that the CLR can find them there.

Upvotes: 2

Related Questions