更新时间:2022-10-29 18:10:37
有且不依赖于构建后事件.
将文件添加到您的项目中,然后在 文件 属性中的复制到输出目录"下选择始终复制"或如果更新则复制".
请参阅 MSDN.p>
Task is to form Visual Studio 2010 project so, that during any build or publish some foo.exe
utility should be copied to output (bin
) directory.
Early I have made PostBuildEvent task in .csproj (MSBuild-file):
<PropertyGroup>
<PostBuildEvent>
Copy "$(SolutionDir)Toolsfoo.exe" "$(ProjectDir)$(OutDir)foo.exe"
</PostBuildEvent>
</PropertyGroup>
But this is not universal. During publishing (Visual Studio 2010) foo.exe
appears in bin
directory, but is not copied to output publish directory. Maybe I do everything completely wrong and there is standard mechanism to include files in projects to be later, during build or publish, copied to bin
?
There is and it is not dependent on post build events.
Add the file to your project, then in the file properties select under "Copy to Output Directory" either "Copy Always" or "Copy if Newer".
See MSDN.