My Software Notes

Useful things I discover

Archive for March 2012

MVC 4 Beta Major Gotcha

leave a comment »

After installing MVC 4 Beta, I noticed that Visual Studio 2010 Intellisense had developed a problem in Razor views in MVC 3 projects.  For example ViewBag wasn’t found and neither was Url.

I looked around for solutions and found various suggestions, but none of them worked and then (I’m not sure whether to say “Duh” or not) I found the solution in the release notes: ASP.NET MVC 4 Beta: Known Issues and BREAKING CHANGES.  (See the “Required Updates” section.)

Now I know that ideally I should have looked at the release notes before installing it.  Sure, and ideally I should never drive faster than the speed limit, but this is the real world and the ideal and the actual don’t always coincide.

I really think that the “Known Issues and Breaking Changes” section of the release notes should have their own link (in BIG CAPS) right next to the big green “Install ASP.NET MVC 4 Beta” button on the ASP.NET MVC 4 page, so that idiots like me will pay attention and maybe actually know ahead of time what might break and take the necessary steps.

For the other poor sods who don’t read release notes here are a couple of the searches I can remember I made and hopefully if you search on the same terms you may find this post.

  • MVC 4 Beta breaks Intellisense
  • MVC 3 Razor View Intellisense Not Working

PS: MVC 4 itself is good so far.


Written by gsdwriter

March 5, 2012 at 10:49 am

MVC 4 Beta – Single Page Application Tutorial – Gotcha

with 6 comments

I’m currently trying out the ASP.NET MVC 4 Beta and I thought I’d give the Single Page Application tutorial a shot.

I’ve created several single page apps so far and they’re working well and people are using them successfully, but now that I’ve had some experience I look at them and wish I could rewrite them from scratch.  If you look back at code you wrote six months ago and don’t think that you could do it better now then either you are perfect or you have stopped learning and are fast becoming antiquated.

Anyway, I want to start using frameworks like knockout.js and backbone.js, and the SPA (Single Page Application) template that comes with MVC 4 uses knockout.js – great.

So I followed the instructions, hit F5 to run the web site, typed “Tasks” in the address bar and … aaargh!  An exceptions in the view and a really unhelpful error message.  “System.InvalidOperationException was unhandled by user code” and “Failed to get the MetadataWorkspace for the DbContext type ‘MvcSpaApp1.Models.MvcSpaApp1Context’.”  The inner exception was no better: “System.Data.ProviderIncompatibleException” and “The provider did not return a ProviderManifestToken string.”

Luckily I’ve been reading up on Entity Framework Code First, so I knew what the problem was – I didn’t have SQL Server Express running.  So I started up SQL Server Express and … still didn’t work.  But this time it was because I didn’t have rights to SQL Server because I was using a machine someone else set up and they had mucked up the security.  Anyway, when I finally got it all sorted out the site ran without any problems.


Other than those gotchas the tutorial is good.

Written by gsdwriter

March 2, 2012 at 11:29 am