Your official information source from the .NET Web Development and Tools group at Microsoft.
I was trying to install MVC4 HotTowel SPA package (MVC4 and Razor v2) on a VS2013 Preview One ASP.NET Web API Project (MVC5 and Razor V3). I blindly let the NuGetNuGet package overwrite all my files including the Views\web.config file, which caused some compatibility problems.
This is what I did:
1. Create a Web API One ASP.NET project
2. Manage NuGet packages, find HotTowel: ASP.NET MVC SPA Template package, click Install.
3. I chose “Yes to All” when prompted for file overwriting. I should have chosen “Yes” and “No” buttons for each file overwriting warning dialog in order to prevent overwriting Views\web.config.
4. CTRL-F5 to run the application, I get the following error in IE:
[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_184.108.40.206__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Users\xinqiu\AppData\Local\Temp\Temporary ASP.NET Files\root\3c4ae604\700fa44c\assembly\dl3\8be5ce88\7c28f49b_e28fce01\System.Web.WebPages.Razor.dll'.
5. It took me quite a while to figure out what was wrong since the ~/web.config is correct, until I realized there is also a Views/web.config file. After I manually corrected the Views/web.config file to match a normal Web API project Views/web.config file, the application works correctly with HotTowel features.
Later I found this experience matches the following StackOverflow question about migrating an MVC4 project to MVC5: http://stackoverflow.com/questions/17454852/upgrading-from-mvc4-to-mvc5-pre-release. So hopefully my simple mistake might have some value to be shared.