Kyle Baley - The Coding Hillbilly

Sponsors

The Lounge

Wicked Cool Jobs

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
ASP.NET MVC and the GAAAK!

Yes, I know how it's spelled. But "GAC" doesn't fully demonstrate the wretching feeling I typically get when I'm dealing with it. So I'm trying my hand on some onomatopoeia.

I was recording a Dimecast this morning on S#arp Architecture because it's an awesome piece of work. But one of the things it (currently) does with the VS template is create an MVC project. That is, a project explicitly linked to the MVC template. And if you don't have that template installed, you get at least one error.

So I went about installing the MSI because I was also feeling some pain not having the various MVC item templates anyway. Tried the S@arp template again and all was well for the three hours it took me to record that ten minute webcast.

Then I switched over to the MVC project I'm working on. It uses an older version of MVC, around preview five-ish. Load up the site and an error appears indicating something like "Html.UrlAction doesn't take 5 parameters" or "Exception: Maybe you ought to take up another line of work" or something. Clearly it is using the assemblies from the GAC rather than the bin directory like I told it.

The best option running through my head is to uninstall the assemblies from the GAC. I get to keep my templates but don't have to deal with versioning issues. Unfortunately, as Phil notes, you can't uninstall an assembly from the GAC if it was installed via MSI. Derik Whittaker says I could probably fix it by removing the MVC stuff from the web.config and re-adding it. Too hacky, says I.

My solution: whine to someone who can possibly solve my problem. In this case, the accommodating Billy McCafferty who assures me that S%arp will no longer have a hard dependency on the MVC templates in the near future. Which means I can uninstall MVC and go back to working with my various projects using different versions of the assemblies.

It's temporary though. At the moment, I can't open up the project I created with S~arp anymore. It gives an error: The project type is not supported by this application. (By the way, the solution to this is to open the .csproj file in a text editor and remove {603c0e0b-db56-11dc-be95-000d561079b0}; from the list of ProjectTypeGUIDs at the top.) In any case, S&arp isn't the only project I've dealt with that is explicitly linked to the MVC templates.

I imagine in order to even get the templates to work, the assemblies it uses need to be somewhere relatively global. Whatever, all I know as a user is: I don't want them in my GAC but I still want the project and item templates to work.

Final note: S*arp makes use of T4Toolbox to do some scaffolding. This project doesn't appear to play well with VisualSVN if you happen to have it installed. The problem I believe is with T4Toolbox but don't quote me. I had to uninstall VisualSVN to get the scaffolding to work. Seems related to similar issues with ActiveWriter.

Kyle the Versioned


Posted Fri, Dec 12 2008 3:00 PM by Kyle Baley

[Advertisement]

Comments

Dylan Beattie wrote re: ASP.NET MVC and the GAAAK!
on Fri, Dec 12 2008 6:31 PM

Hi,

It is possible - with a little tinkering - to remove ASP.NET MVC from the GAC whilst keeping the project templates installed. I've posted some notes on doing this at dylanbeattie.blogspot.com/.../working-on-aspnet-mvc-beta-and-preview.html if you're interested.

Kyle Baley wrote re: ASP.NET MVC and the GAAAK!
on Fri, Dec 12 2008 9:02 PM

Dylan Beattie, you are an honorary hillbilly for that bit of goodness! Thanks!

ASP.NET MVC Archived Blog Posts, Page 1 wrote ASP.NET MVC Archived Blog Posts, Page 1
on Fri, Dec 12 2008 11:58 PM

Pingback from  ASP.NET MVC Archived Blog Posts, Page 1

Billy McCafferty wrote re: ASP.NET MVC and the GAAAK!
on Sat, Dec 13 2008 12:11 PM

You seem to have an unfairly effective technique for moving things up on my priority list. ;)  The fix for this has been checked into the trunk and to the pre-packaged Visual Studio template at sharp-architecture.googlecode.com/.../VisualStudioTemplates

Dew Drop - December 13, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop - December 13, 2008 | Alvin Ashcraft's Morning Dew
on Sat, Dec 13 2008 12:22 PM

Pingback from  Dew Drop - December 13, 2008 | Alvin Ashcraft's Morning Dew

DotNetKicks.com wrote Asp.Net MVC and the Gaak
on Fri, Dec 19 2008 12:28 AM

You've been kicked (a good thing) - Trackback from DotNetKicks.com

Hernan Garcia wrote re: ASP.NET MVC and the GAAAK!
on Fri, Dec 19 2008 12:47 AM

I was trying to post this to the discussion group but I need to wait for approval and I'm very impatien :-)

About losing the Item Templates for your MVC projects. You can easily create Item templates even if you don't use ReSharper.

Check this instructions: msdn.microsoft.com/.../tsyyf0yh(VS.80).aspx is really that simple.

Hope this helps, H.

Kyle Baley wrote re: ASP.NET MVC and the GAAAK!
on Fri, Dec 19 2008 8:03 AM

Hernan, we are discussing something similar on the S~arp group. It seems when you remove the MVC GUID from the project types, you no longer get the Item Templates (like Add New View Content Page), even if you have MVC installed.

Now, as you mention, it's easy to create your own but by the same token, the View templates are basic enough that you don't even need them. Most of the time, it's as simple as changing the base type from Page to ViewPage. And very often, I don't even need that. You can delete the code-behind file altogether and use the ViewPage base type as the code-behind file directly in your .aspx page. Assuming you remember the funky `[] CLR notation for generic types.

Hernan Garcia wrote re: ASP.NET MVC and the GAAAK!
on Fri, Dec 19 2008 11:00 PM

I totally agree, I personally prefer to use Spark as my view engine.

I was reading the Sharp group as well.

RC1 won't use code behind, so we won't even have to worry about any of this at all.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Devlicio.us