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
I observed that when I use VS2012 Publish Web Deploy Package feature, it generates a .zip file. Inside that zip there is a file called archive.xml that contains a createApp tag with the attribute 'managedRuntimeVersion="v4.0"' . When I use msdeploy.exe to sync it to an iis instance, it works.
However, when I use msbuild.exe to create a web package .zip file, it contains an archive.xml that has 'managedRuntimeVersion="v4.5"'. Trying to deploy this web package to IIS using msdeploy.exe results in the ERROR_APPPOOL_VERSION_MISMATCH error.
As Sayed Ibrahim Hashimi explained here, adding "/p:VisualStudioVersion=11.0" to my msbuild.exe command line effectively forces 'managedRuntimeVersion="v4.0"' in the archive.xml of the resulting web package so it resolves the issue.