问题
I've got a dll, into which I've inserted txt files into the names subdirectory
When I build the solution, VS does not create the directory and does not copy the files themselves into the directory of the exe file, which references the dll library
Is there an easy way to make it do that?
回答1:
It should do that, provided that you have a reference for the class library project in your executable project. I just setup a scenario like this in Visual Studio 2010:
- Created a C# Console Application project
- Created a C# Class Library project
- Added a Reference to the C# Class Library project into the Console Application project.
- Added a folder to the C# Class Library project called 'Files'
- Added a Text File to the 'Files' folder called 'File1.txt'
- Set the Text File 'File1.txt' 'Copy to Output Directory' property to 'Copy Always'
- Did a 'Build Solution' and looked in the bin directory of my Console Application and low and behold there was a folder called 'Files' and within it, a file called 'File1.txt'
Maybe you are missing a project reference to your class library in your exe?
来源:https://stackoverflow.com/questions/9186059/visual-studio-2010-how-to-automatically-copy-files-into-debug-directory