Here is brief explanation about my project.
By using Build Definition, when I execute the build, two steps has to be executed
To do so, I needed to use 'Add Items to Folder..' to add the file that i generated after the first step is done. And, execute the build again for the second step...
How can i automatically add the items to folder? I want to run the build only ONE time..
If my explanation is not clear, please let me know.
When you run your build definition on the build agent you’re executing a build workflow which will do some preparation steps and eventually it will run msbuld to build your projects/solution. You can modify the build workflow, but that process has bigger learning curve and you need to be comfortable with Windows Workflow Foundation, that’s why I will concentrate on the msbuild part.
The general rule is to somehow plug your msbuild target into the life cycle of msbuild process and run your routines, like creation of that extra file and adding it to the appropriate places. If you have web application project with a name mywebapplication.csproj you can create mywebapplication.wpp.targets msbuild file which will become part of you web application build process, and you can trigger your own targets. e.g.
<Target Name="MyTarget" AfterTargets="CoreCompile"> </Target>
CoreCompile is target which comes as a part of your .NET/Sdk/Visual studio install. You can use other targets as well. In the example “MyTarget” will get executed after you trigger compilation of your project. In your target you can create the file.
For web application if you’re publishing it with msdeploy you can use collection to add your own files you had previously created to the deployment package and if you do that your file will be automatically deployed. You can do that in “MyTarget” in the above example. A good blog which will give you lots of ideas is http://sedodream.com/, he is the main guy about the build automation process and if you want to get really familiar with the deployment process definitely buy his book. Here he is explaining how to add your own files to the deployment package
http://sedodream.com/2012/10/09/VSWebPublishHowToIncludeFilesOutsideOfTheProjectToBePublished.aspx
For other type of projects you need you make your own msbuild project and run it instead. There again you can have your own target where you can do your stuff with the file, you can build explicitly your project, solution by calling <msbuild/>
task.
I hope that helps.
Biser