I’m doing a solution which has a 3 projects(c#).
- Main executable project
- Dll
- Dll
Main project has references to others.
I want to have following file structure in my main project:
main.exe
Libraries - folder
+ 2.dll
+ 3.dll
But unfortunately VS is putting those DLL files to EXE location.
It there any simple solution to do it?
You can change the Output Path on the child DLLs to point to Libraries.
However, this is not a standard path that .Net probes at runtime for DLL resolution, so you will likely have issues when you try to deploy this unless you load from these locations by hand.
If you have the project reference marked to Copy Local, then I don’t believe that you can change the directory that Visual Studio copies files into through configuration.
However, you could setup a post-build command that automatically moves the files into the desired subdirectory after each build.
Update
I love this site because it enables me to learn new things every day. As a case in point, I just discovered the probing element that you can add to your config file in order to add additional paths to the standard probing paths.
This configuration element allow .Net to search your
librariesfolder for DLLs to load so that you don’t have to do any additional work once they are in place (you will still need to move them to that directory using a postbuild command).Here is a sample config entry to support your configuration: