Visual Studio 2010: how to automatically copy files into debug directory

♀尐吖头ヾ 提交于 2020-04-11 04:12:07

问题


I've got a dll, into which I've inserted txt files into the names subdirectory enter image description here

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:

  1. Created a C# Console Application project
  2. Created a C# Class Library project
  3. Added a Reference to the C# Class Library project into the Console Application project.
  4. Added a folder to the C# Class Library project called 'Files'
  5. Added a Text File to the 'Files' folder called 'File1.txt'
  6. Set the Text File 'File1.txt' 'Copy to Output Directory' property to 'Copy Always'
  7. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!