How to run tasks in parallel in MSBuild
Try the new parallel task in the MSBuild Extension Pack – http://mikefourie.wordpress.com/2012/02/29/executing-msbuild-targets-in-parallel-part-1
Try the new parallel task in the MSBuild Extension Pack – http://mikefourie.wordpress.com/2012/02/29/executing-msbuild-targets-in-parallel-part-1
David Kean’s comment here gave me the answer I’m using for the moment: or remove the <ProjectTypeGuid> element entirely – this will opt you of “portable” enhancements, such as a UI for changing the target framework, etc I’ve tried that, and it works like a dream. On machines which have everything appropriately installed, you can … Read more
And the answer is… Following my edit above about the current identity’s username persisting to the MSDeploy command even when not passed in the original MSBuild call, I tried reconstructing the parameters to pass an empty username as follows: MSBuild.exe Web.csproj /p:Configuration=Debug /p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish /p:MsDeployServiceUrl=http://[server name]/MsDeployAgentService /p:DeployIisAppPath=DeploymentTestProject /p:MSDeployPublishMethod=RemoteAgent /p:CreatePackageOnPublish=True /p:username= Which then generates the following … Read more
If you add the following xml to the bottom of the .csproj file for your web application, you’ll ensure that the config transformation occurs before every build: <Import Project=”$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets” /> <Target Name=”BeforeBuild”> <TransformXml Source=”Web.Base.config” Transform=”Web.$(Configuration).config” Destination=”Web.config” /> </Target> Edit: In response to your comment, you should be able to use Web.config as the source parameter … Read more
In MSBuild 4.0 this is possible: <ItemGroup> <Folders Include=”$([System.IO.Directory]::GetDirectories("$(RootFolder)"))” /> </ItemGroup> Property Functions: http://msdn.microsoft.com/en-us/library/dd633440.aspx
I can elaborate a bit on options #1/#3 and compare them. The previous reply was not accurate in stating that you have to build multiple times with PackageWeb, you only need to build once. Option 1: Parameters.xml and SetParameters.xml In this approach you will create a parameters.xml file in your web project which will declare … Read more
Within your build definition, I recommend adding a Copy Files step that will copy your the build artifacts from your msbuild results to the Build’s Artifact Staging Directory before you run the Publish Artifact step. Source Folder: $(Build.SourcesDirectory) Contents: **\bin\$(BuildConfiguration)\** Target Folder: $(Build.ArtifactStagingDirectory) I am assuming that the $(BuildConfiguration) variable is custom to your definition … Read more
As noted by @dprice in his comment, the best solution for this would be: <Error Condition=”Exists(‘C:\Process\Fail.txt’)” Text=”Process did not pass!” />
In MSBuild 4.0+, there’s a $(MSBuildProgramFiles32) property for it, which you can confidently employ directly (especially if you’re prepared to put a ToolsVersion=”4.0″ at the top of the file to guarantee it’s going to be available and Fail Fast if it’s not). If you’re not and need something that can Do The Right Thing even … Read more