I was recently playing around with the [SPA scaffolding from Steve Sanderson][1] and after installing MVC 4 RC my project stopped compiling for a number of reasons. Searching on the web made it clear that the SPA scaffolding would only work with the Beta not the RC and would also not be available in the final version 4.
Below are some tips and the required NuGet packages to get your SPA project compiling and running again…
[1]: http://blog.stevensanderson.com/category/spa/
To setup correctly after installing RC, first uninstall all packages from Tools > Library Package Manager > Manage Nuget Packages for Solution...
on the menubar. If you get any warnings about dependencies, uninstall them first. When all the Nuget packages have been removed, install the following packages:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Install-Package Microsoft.Web.Optimization -Pre Install-Package System.Web.Providers Install-Package -IgnoreDependencies EntityFramework -Version 5.0.0-beta1 -Pre Install-Package -IgnoreDependencies AspNetWebApi -Version 4.0.20126.16343 Install-Package -IgnoreDependencies AspNetWebApi.Data Install-Package -IgnoreDependencies System.Net.Http -Version 2.0.20126.16343 Install-Package -IgnoreDependencies System.Json Install-Package -IgnoreDependencies System.Net.Http.Formatting -Version 4.0.20126.16343 Install-Package -IgnoreDependencies System.Web.Http.Common Install-Package -IgnoreDependencies AspNetRazor.Core -Version 2.0.20126.16343 Install-Package -IgnoreDependencies Microsoft.Web.Infrastructure Install-Package -IgnoreDependencies AspNetWebPages.Core -Version 2.0.20126.16343 Install-Package -IgnoreDependencies AspNetMvc -Version 4.0.20126.16343 Install-Package -IgnoreDependencies knockoutjs Install-Package -IgnoreDependencies jQuery Install-Package -IgnoreDependencies Upshot Install-Package -IgnoreDependencies SinglePageApplication Install-Package -IgnoreDependencies System.Net.Http -Version 2.0.20126.16343 |
You might also need to add a reference to System.Web.Http
afterwards.
Add a comment if I’ve missed something.