Question

After migrating TeamCity from one server to another, and also switching to Visual Studio 2013, our build fails when using MSDeploy to push a TC-built .zip package to IIS.

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

This is a strange error since my IIS server has .NET 4.5 installed and has been happily running and being deployed to for weeks, and a 4.0 application pool will run a 4.5 targeted app.

Unfortunately, the waters are muddied by the changes to TC and VS (2013) so what caused the issue I cannot be sure of.

Note: Our TC server only has Visual Studio 2012 on it, since I'm on MSDN and got early access to 2013. This could be the culprit, but doesn't make the issue any less odd.

Was it helpful?

Solution

I'd prefer not to disabled .NET runtime version checking at all (with IgnoreDeployManagedRuntimeVersion), but instead implicit set runtime version via DeployManagedRuntimeVersion:

<DeployManagedRuntimeVersion>v4.0</DeployManagedRuntimeVersion>

Some more details: http://techblog.dorogin.com/2013/11/deploying-45-projects-with-webdeploy.html

OTHER TIPS

Open your .csproj file and set the following element:

<IgnoreDeployManagedRuntimeVersion>True</IgnoreDeployManagedRuntimeVersion>

Adding it just above this element helps readability:

<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

Kudos to https://stackoverflow.com/users/1769923/abhishikt-n-jain for answering with this little-known config setting here:

MSBuild deploy failing after upgrade to .NET 4.5

If anyone knows why this happens, please feel free to add an answer.

Update

Disregard my comments below. While it got me past the deploy, I got a 503 Service Unavailable when I actually tried to run the web app. I backed out this change by setting the managedRuntimeVersion property back to v4.0 and added the IgnoreDeployManagedRuntimeVersion to my project. Then the deploy succeeded and the app worked. Dumb...


This happened to me after I installed .NET Framework 4.5.1 on a Windows Server 2008 R2 SP1 machine (as part of upgrading Powershell).

The IIS user interface on Windows Server 2008 doesn't give the option of setting the managedRuntimeVersion property to v4.5 even after that version is installed. However, this can be done on the command line using the appcmd utility as @3boysdad's answer shows.

appcmd is the command-line equivalent of managing IIS sites, apps, apppools, etc. It is located at %systemroot%\system32\inetsrv\appcmd.exe but it is not on the PATH as the following link explains:

http://www.iis.net/learn/get-started/getting-started-with-iis/getting-started-with-appcmdexe#HowToUse

I'm of the opinion that modifying your project (via the IgnoreDeployManagedRuntimeVersion or DeployManagedRuntimeVersion properties) is sub-optimal. The application pool should be set to use v4.5, and the only way to do that on Windows Server 2008 is to use the appcmd utility. @3boysdad's answer should be the accepted answer.

found this gem while hunting around for this same problem.

appcmd set apppool /apppool.name: <your app pool> /managedRuntimeVersion:v4.5

this will need to be executed in your \System32\inetsrv directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top