How can I control which version of the msbuild file is used between .NET4 and 4.5RC?

On my development laptop, I only have VS2012 RC installed, and I can successfully connect to the new MSDeploy.pubxml plumbing (DeployOnBuild and PublishProfile parameters) from powershell (via psake) to deploy my website on our test server.

However, on my build server, I first installed VS2010 SP1, and now I additionally installed 2012 RC (I have other builds on this computer, still .NET 4).

When I run the same script with exactly the same parameters, I see different results between my dev machine and the build server. The command I run is

exec { msbuild "Website\WebSite.csproj" /mp:DeployOnBuild=True /p:PublishProfile=MyTestProfile } 

On the build server, this does not actually run MSDeploy, but simply the packaging bits that fasten the site and create the deployment package. My machine successfully selects the pubxml file and makes a successful deployment.

In the end, I believe that I traced this problem in the Microsoft.Web.Publishing.targets file. On my dev machine, I only have

 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web 

but the server additionally has

 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web 

and it seems that this file (without knowledge of the .pubxml material) is used there.

Has anyone realized what I need to collapse (preferably in my own msbuild files so that I don't mess up anything on the build server for build 4.0) to get msbuild to get the version of v11.0 file and thereby use my .pubxml file?

+6
source share
1 answer

Interestingly, you need to pick the latest version (v11.0), it seems that there is an error here. This is controlled by the MSBuild VisualStudioVersion property.

Here are the rules for how this value is populated during assembly. 1. If VisualStudioVersion is defined as an environment variable or a global property (for example, / p: on the command line) that wins. So Dev11 and the Dev11 command line are always v11 - both of them define VSV as an environment variable 1. Otherwise, if there is a toolbox that corresponds to the version of the equivalent solution (which is currently always a version of the file format - 1), select 1. In otherwise, get the default version; 10.0, if Dev10 is installed, the version with an extended set of tools (currently always 11) is installed, otherwise

In your case, since you are facing a problem, you can pass the /p:VisualStudioVersion=11.0 property to make sure that the correct targets are being used.

+12
source

Source: https://habr.com/ru/post/917546/


All Articles