Visual Studio: How to “Copy to Output Directory” without copying the folder structure?

后端 未结 8 992
礼貌的吻别
礼貌的吻别 2020-12-04 08:43

I have a few dll files in \\lib folder of my project folder. In the property page of dll, I have selected \"Build Action\" as \"Content\" and \"Copy to Output Directory\" as

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 09:17

    Keep them in $(ProjectDir)\Lib, but add those files "As a link" to the root of your .csproj. Now they will get copied to bin\Debug (or whatever other output folder) without being in lib.

    EDIT: This answer was written way back when ContentWithTargetPath was not available in the versions of VS/MSBuild I was using. Leaving this answer here for people who might have to use an older version of VS. Please stop commenting on this, we all know there are better ways now.

提交回复
热议问题