I used +Scott Hanselman post before to get MVC3 into an existing ASP.Net project I wanted to port in stages. So this time when I wanted to do the same with MVC4 I went digging for the same article and thought, about time I added it to a blog to find it easier in future.
So using Scotts well documented approach, I was able to get going again quickly. There were a couple of bumps to smooth out though.
Remove the superfluous rubbish a standard VS project adds (Basic Template)
- Global.asax.cs
- using System.Web.Optimization;
- WebApiConfig.Register(GlobalConfiguration.Configuration);
- BundleConfig.RegisterBundles(BundleTable.Bundles);
- Views/Shared/WEb.Config under system.web.webPages.razor/pages/namespaces
- <add namespace="System.Web.Optimization"/>
You'll most likely find System.Web.Optimization strangely missing (causing compilation or run-time errors), dependent on when and how you installed MVC4, anyhow in my opinion - YAGNI.
So in case you end up here instead of on +Scott Hanselman blog site as you were looking for a MVC4 option, head over there and get busy!