Deploying a .Net 4.5 website to an IIS 7.5 server

.net-4.5iis-7.5teamcity

We are using Teamcity to do continuous integration builds for our website and have just upgraded our website to .Net 4.5RC. The application builds and runs in IIS express on my box and builds on our build server that I have installed .NEt 4.5RC on. But when we deploy it to the server that has had .Net 4.5RC installed on it we get the following error.

The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v4.0'. This application requires 'v4.5'.

What can I do to fix this problem. I have tried setting the application pool on the server to 4.5, but can't. See this SO post.

Best Answer

I had a similar problem. I was building my application by calling MSBuild, and I found that when I tried to web-deploy the application I got that error. I fixed it by telling MSBuild to build with VS2012, by adding a commandline switch to the MSBuild command:

/P:VisualStudioVersion=11.0

Tip o' the hat to this question.