使用Visual Studio复制文件? [英] using Visual Studio to copy files?
问题描述
我想创建一个Visual Studio(我使用VSTS 2008)项目,它只是做文件复制工作,更详细的,我将添加一些文件到这个项目和这个项目复制文件(包括在这个项目)
任何想法如何在VSTS中实现?
听说使用proj文件可以做这样的任务,但我没有找到任何好的简单的学习样本初学者。 : - )提前感谢,
George
p>您可以在Visual Studio中添加一个后期构建步骤:
- 打开项目属性(这在C#项目中有效,我猜VB
-
您可以添加后期构建事件命令,例如
copy $(ProjectDir)\bin\ * SOME_OTHER_FOLDER\ *
$(ProjectDir)是一个宏,还有一些可用的,当你编辑一个命令时, >
然后,如果你看看相应的项目文件(XYZ.csproj或XYZ.vbproj),你可以看到一个属性组添加在文件的底部,如:
< PropertyGroup>
< PostBuildEvent> copy $(ProjectDir)\bin\ * SOME_OTHER_FOLDER\ *< / PostBuildEvent>
< / PropertyGroup>
这是直接编辑MSBuild文件时的操作方式。注意,你不需要启动Visual Studio为了构建和复制你的文件,你可以只传递项目文件到msbuild.exe。
I want to create a Visual Studio (I am using VSTS 2008) project which simply does file copy work, in more details, I will add some files to this project and this project copy files (included in this project) to some destination location when I build the project.
Any ideas how to do this in VSTS?
BTW: I heard using proj file could do such kinds of task, but I have not found any good simple to learn samples for beginner. :-)
thanks in advance, George
You can add a post build step in Visual Studio:
- Open the project properties (this works in C# projects, I guess for VB.NET this applies as well).
- Select the Build Events tab
There you can add the post build event commands, for example
copy $(ProjectDir)\bin\* SOME_OTHER_FOLDER\*
The $(ProjectDir) is a macro, there are a few more available, they will be shown, when you edit a command.
Then, if you have a look at the according project file (XYZ.csproj or XYZ.vbproj), you can see a property group added at the bottom of the file, such as:
<PropertyGroup>
<PostBuildEvent>copy $(ProjectDir)\bin\* SOME_OTHER_FOLDER\*</PostBuildEvent>
</PropertyGroup>
This is how you would do it when directly editing an MSBuild file. Note that you don't need to launch Visual Studio in order to build and have your files copied, you can just pass the project file to the msbuild.exe.
这篇关于使用Visual Studio复制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!