Problem With Running an MVC3 Project on IIS After Opening and Building in Visual Studio 2012

I was having trouble running a .NET 4.0, MVC3 web application locally on IIS after building in VS2012. The unit tests would pass, all projects would build successfully, and it would even run from Cassini, but something was just not working properly on IIS. This project SPECIFICALLY references MVC3 assemblies that are included in a packages folder in the project, so I didn’t think it was MVC, but all signs were pointing to that. I uninstalled MVC4, tried changing the references, but everything was still failing.

So today I started going a little slower and found the culprit.

When you open a VS2010 solution in VS2012, you are greeted with a little HTML report of things that it decided to change for you so your project / solution would play nicely in both environments. For the most part, this all seems to work quite nicely.

01

I noticed that:

02

03

The big thing that jumped out at me today was that web.config was changing along with the .csproj file after I changed the framework.

04

This set off alarms in my brain, mostly “Why isn’t TargetFrameworkVersion already there?”

So I reverted everything and instead of letting VS2012 change the framework, I just opened the .csproj in Sublime Text 2 (or any text editor) and added this:

<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

After saving the .csproj file, re-opening the solution and letting VS2012 perform it’s conversion, and building, the site runs again as expected from IIS. I lost WAY too much time to that nonsense. Hopefully nobody else has to.

Comments

comments powered by Disqus