We recently upgraded our VS 2010 and .NET 4 application to VS 2012 and .NET 4.5. We have a build script to deploy the application on the test server. We have two boxes - one is Windows 8 with VS 2012 (fresh install) and other is Windows 7 with VS 2010 and VS 2012 (installed newly).
When running the build script from Windows 8 box build script is working well and deploys the application to test server. But when deploying the application from Windows 7 box I get the following error:
"C:\Achinth\Build\Work\build\qa1sb.proj" (DeployAll target) (1) ->"C:\Achinth\Build\Work\App\App.csproj" (ResolveReferences;MsDeployPublish target) (2) ->(MSDeployPublish target) -> C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3847,5): error : Web deployment task failed.((8/19/2012 6:23:41 PM) An error occurred when the request was processed on the remote computer.) [C:\Achinth\Build\Work\App\App.csproj]C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3847,5): error : \r [C:\Achinth\Build\Work\App\App.csproj]C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3847,5): error : (8/19/2012 6:23:41 PM) An error occurred when the request was processed on the remote computer.\r [C:\Achinth\Build\Work\App\App.csproj]C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3847,5): error : The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v4.0'. This application requires 'v4.5'. [C:\Achinth\Build\Work\App\App.csproj]
Looking at the error it looks like that MSBuild is using VS 2010 targets instead of VS 2012, which is causing the error. Since Windows 8 box does not have VS 2010 it is using VS 2012 targets correctly.
Can some one please provide pointers on how to make MSBuild to pick the right version?