I have configured a TFS Build using the default template and run my build based on a schedule. I also have a separate msbuild file that needs to be run along with TFS Build for which I have created an InvokeProcess activity that executes a batch file with msbuild command.
However I get exceptions msbuild cannot be recognized as an internal or external command. Is this the right way to do it?
Thanks
Jai
Related
Not too sure if what I'm asking here is possible, or if it requires an upgrade. My problem is that I have a local install of TFS 2013 (that is, on-premises), and all dev machines have now upgraded to VS2015. However, when using new features (such as $"test {teststring}"), we get build errors.
The build machine has both VS2013 and VS2015 installed, and is using the default build template (TfvcTemplate.12.xaml). Looking at the "Run MSBuild" task inside the build workflow, there doesn't seem to be any way to point it to one MSBuild or another.
Is it possible to hint to the build to use the later version of VS / MSBuild and, if so, how?
Try adding /tv:14 to the msbuild commandline arguments in your build template, if that doesn't work, edit the xaml file for your build process template and override the "ToolPath" property of the "Run MsBuild for Project" task. Or make that field configurable through further customization of the build template.
Set that path to C:\Program Files (x86)\MSBuild\14.0\Bin (or your equivalend location in case your machine uses alternate default directory names).
Where can I set pre-build script path and pre-build script arguments for build process template in TFS 2012? I found these options in TFS 2013 as shown in the image:
You have two options for for TFS 2012.
You will need to add a new activity to your workflow to call a pre-build script or
Set your build process to build a MSBuild project file (not a solution). This project file will be your custom build entry point and you can add your pre-build work in this project. Once the pre-build work is done you can start the solution build.
How do I make the command to run sonar-runner at the end of the build TFS (Team Foundation Server) in continuous integration?
Info: TFS 2013, Windows Server 2008 R2, sonar-runner 2.3
The only way to execute arbitrary commands as part of the build process is to add an InvokeProcess activity to the BuildProcessTemplate. This isn't as difficult as it may seem at first.
Make a copy of the DefaultTemplate.xaml which is located in the /BuildProcessTemplates folder of your team project. Name it whatever you want - SonarRunnerTemplate.xaml or something.
Open up the new template in Visual Studio
Hit "Collapse All" at the top right to ease navigation to the proper activity.
Browse to Process > Sequence > Run On Agent > Try Compule, Test, and Associate Changesets and Work Items > in the Finally clause > Revert Workspace and Copy Files > If DropBuild And DropLocation is Set
In the "Then" box you will see a Copy Files to Drop Location activity. Move this into the "Else" box temporarily.
Add a Sequence activity from the Toolbox into the (now empty) Then box
Move the Copy Files to Drop Location (which we moved earlier) back into the Sequence activity you just added to the Then box.
Add a InvokeProcess activity from the Toolbox to run AFTER the "Copy Files to Drop Location" activity
Open the Properties for the InvokeProcess activity. The FileName field is the command which you need to execute. In this case, the command to execute your Sonar runner. It might be easiest to write a batch or powershell script which runs Sonar... and then invoke that.
Save the build process template and add it to TFS. You can then use this template for your build definition.
One issue with this approach is that the build will not "finish" until after the InvokeProcess command has returned. So if your sonar run takes a really long time (I know I have seen it take over 24 hours for a large codebase) the build will take forever to complete. This can be mitigated by having your script spawn off the Sonar process asynchronously.
There is now an official way to get MsBuild and TeamBuild to work with SonarQube, as part of a collaboration between Microsoft and SonarQube. You can find all the details on the SonarQube website:
http://www.sonarqube.org/announcing-sonarqube-integration-with-msbuild-and-team-build/
And on the Microsoft ALM website:
http://blogs.msdn.com/b/visualstudioalm/archive/2015/04/28/technical-debt-management-announcing-sonarqube-integration-with-msbuild-and-team-build.aspx
There is also documentation prepared by the ALM rangers that describe how to install SonarQube and integrate it with an existing TFS server:
https://vsarguidance.codeplex.com/downloads/get/1452516
I am trying to build my solution at the TFS2010, after successfull build, I am trying to make TFS2010 run another application, like VS Post-build event.
It can be possible? and How can I make It?
What you probably need to do is add an activity to your process template for your build.
In your build configuration, the Process area allows you to specify the template that will be used to execute the build. This XAML file should already be source controlled in your TFS project. You can create a new XAML based on your current one, or if you have already created your own just check out your XAML and edit it.
I'm not familiar with DBDeploy or how to invoke it, but if it has command-line arguments you can likely add an InvokeProcess activity to your build workflow and execute a Powershell command script to do what you need to add after the build.
I have been using a msbuild file that builds and packages my solution to 'Client' and 'Server'. So far I have been using the below cmd to build from VS cmd prompt:
msbuild.exe MyBuildFile.proj /t:Build
(I have a target called 'Build' which will kick start build and do the rest).
Now, my team wants to queue builds in TFS build server. I read about TFSBuild.proj file. Should I once again write all the scripts in to TFSBuild.Proj or is there a way by which I can call my 'MyBuildFile.proj /t:Build' from TFSBuild.Proj.
Any help is appreciated.
Thanks, Mani
You can just include your existing MyBuildFile.proj in a TFS 2010 build:
Create a new build definition
In the Process page, choose the UpgradeTemplate.xaml workflow
Select the directory of your checked-in MSBuild.proj file of choice (checked-in under the name TFSBuild.proj)
There might be some subtle differences between your development system and the build server that you need to take care of, but above steps should take you 85%. Enable Diagnostic level build information verbosity (also to be set on the Process page) to troubleshoot loose ends.