Question

My company uses the MSBuild Community Tasks to provide custom build scripts to our projects. Today, I created a new project and built out a custom build script to run it. I was able to set up builds on TFS, so I know my script works correctly, but I can't figure out how to get Visuale Studio to point the script so that it uses it whenever I build locally.

How do I point visual studio to my custom build script?

Was it helpful?

Solution

You can use custom msbuild scripts in Visual Studio by editing each .csproj that will use the custom script. In the Solution Explorer, right-click on the project and select "Unload Project", then right click on it again and select "Edit [projectname].csproj", which will open it up as an editable xml file. You will notice this is an msbuild script too, so all you have to do to add your custom scripts is add the <Import Project=....> statement and maybe a <Target Name=... DependsOnTargets=...> to call it at certain points of the build process.

If you want the same process that TFBuild gives using the MSBuild scripts (which can be applied at the solution level instead of just the project level), then you might want to just add an external tool call to MSBuild.exe with the same parameters that TFBuild uses. You can find how to set that up here: http://en.csharp-online.net/MSBuild%3A_By_Example%E2%80%94Integrating_MSBuild_into_Visual_Studio

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top