Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 27, 2010 06:23 PM by raylinder
Jan 31, 2009 05:31 PM|LINK
Hello, I just started to play around with MVC and today I tried to create a strongly typed view using RC1.
Though, first of all I didn't received any intellisence as I expected (and read about) and when I try to run it I get this error:
Could not load type 'System.Web.Mvc.ViewPage<MyMvcProject.Models.MyObject>'.
The first line was automatic added through the "add View wizard" in RC1 (no code behind files which I like a lot)
Line 1: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MyMvcProject.Models.MyObject>" %
I'm sure there's a very "stupid" thing that I'm overlooking, but it might help (and go faster) is someone can point me out here.
I assume it has something to do with the <> syntax for generics, but I read everywhere this should work in RC1. (It didn't work either with '1[ ] )
I also found out that RC1 does NOT install the System.Web.Mvc reference in the GAC (error in the msi?)
Thanks for any help
Jan 31, 2009 06:01 PM|LINK
I have the same problem, but I tryed to update MVC Beta to MVC RC1.
After the upgrade - all is fine, but when I create strongly typed page (by one page with no cede behind) i get this error:
Cannot Load Type 'System.Web.Mvc.ViewPage<ConceptStyle.Models.CcsAuto.Field>'.
Line 1: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ConceptStyle.Models.CcsAuto.Field>" %>
I've tryed to place a simple types like List<int>, but this doesn't work too.
I created a new MVC application - all works fine. Compared web.configs - all posible issues is the same.
What is wrong?
Jan 31, 2009 06:45 PM|LINK
So you're saying that it does work by creating a complete new application from scratch using RC?
I can try that (I also updated from beta to RC). I'm still playing around and haven't written much essentials in the web application. Though it would be nice to know what has to be done to upgrade correctly.
Jan 31, 2009 06:48 PM|LINK
1. the dlls are installed in gac. If you're not seeing System.Web.Mvc there then something went wrong with the installation. Try removing it and installing it again
2. I've been using the new view syntax without any problems. It seems like you're not using the correct MVC assemblies. Have youtried removing the references and adding them again?
final note: you can stop using the namespace on the < > if you add an Imports directive to the page:
<%@ Import Namespace="MVCRC.Models"%>
ANd then you can simply put: Inherits="System.Web.Mvc.ViewPage<DumbData>"
Jan 31, 2009 08:05 PM|LINK
Well, I tried a lot of things without success. The only thing that worked perfectly, is when you create a complete new mvc project from scratch. Then you can do everything, but upgrading from beta didn't worked for me.
I guess it does have to do something with the GAC and VS that not seems to work correctly. These are the steps I went through without success.
1) uninstall ASP.NET MVC through control panel
2) check with gacutil if all dll's are gone from the gac (System.Web.Abstractions and System.Web.Routing where still in there)
3) tried to manually remove them from the GAC --> failed because they where "in use by an installer"
4) reboot pc (didn't fixed the lock)
5) went through this article (removing from the registery so I could uninstall them from GAC manually)
http://dylanbeattie.blogspot.com/2008/11/working-on-aspnet-mvc-beta-and-preview.html (Now this is unknown territory for me, but since i don't have a wife or cat
and I can always buy a new pc I thought I'd give it a try. I did only remove the first key though)
6) install mvc rc again through the msi (checked with gacutil, all dll's are there again)
7) opened my solution and removed all mvc references from my project
8) try to add references again with "add reference" --> NO System.Web.Mvc listed
9) add manually mvc dll's by browsing to the folder (program files/microsoft asp.net/asp.net mvc rc/assemblies)
10) run it with no success at all
11) create a complete new mvc application from scratch
12) create a quick strong typed view, received the promised intellisence
13) run with success....
In my case it's ok. I just need an extra hour or so to add the few classes to a new project, but still I'd like to know (to satisfy my own curiosity) how to convert a beta to rc. It has to be possible. I am running it under Vista Ultimate sp1. Don't think
it should do anything.
Jan 31, 2009 08:55 PM|LINK
I've installed MVC RC on another machine and i can confirm that it is on the gac and listed on the add reference dialog. if it's not there, then something has gone wrong. btw, do keep in mind that being in the gac is not enough for being shown on the add
Having said that, I'm not sure on why you're not seeing the assembly on that dialog...
Jan 31, 2009 09:15 PM|LINK
Absolutely the same thing. I don't see an assembly in reference .NET menu. I've tryed to add manually from (program files/microsoft asp.net/asp.net mvc rc/assemblies), tryed to set copy local or get from gac, tryed to delete all the old assemblies. Tryed
to copy them manually and add from \bin. Works only on new project.
I can copy classes to a new project, etc... But what is wrong? I can't understand. Why doesn't it work when I copy assemlies and set them manually?
Feb 01, 2009 01:53 AM|LINK
Doesn't work after the project migration. Something breaks it... Can't find out what.
Feb 01, 2009 01:50 PM|LINK
Create a brand new Asp.net MVC Application, copy ~/Views/Web.config to override the one of your existing project.
If it's still not working, do the same for ~/Web.config (and of course merge the changes you've made).
I've met the problem because some of these places references the GAC version of System.Web.Mvc assembly, and my code references my custom build of the released source code.
Feb 01, 2009 02:32 PM|LINK
Yep, had forgotten about the web.config on the Views folder. That one must point to the correct version too...