Including content files in .csproj that are outside the project cone

前端 未结 7 1755
忘掉有多难
忘掉有多难 2020-11-27 12:09

I have a C# project say MyProject.csproj located at \"C:\\Projects\\MyProject\\\". I also have files that I want copied into the output directory of this project. But, the f

7条回答
  •  情歌与酒
    2020-11-27 12:33

    You need to add file as a link:

    1. Right click on the project in VS.
    2. Add -> Existing Item...
    3. Find the file.
    4. Select it and.
    5. Add as a Link (drop down in the Add Button in the dialog).
    6. Open the properties of the file and set "Copy to Output Directory" to "Copy always".

    BUT You cannot do it for the directory tree.
    Instead you need to write post-build task for that. This is a sample that will get you stared.

提交回复
热议问题