views:

850

answers:

2

I've been toying with the idea of taking an existing ASP.NET Webforms application and converting it to a hybrid so that going forward, we can do ASP.NET MVC.

In order to do this, I created an ASP.NET MVC application and started copying some of the folders from the ASP.NET webforms projects that contain webforms. I'm having a problem building the resulting project getting hundreds of compile errors of this form:

Error   1951 'Documents_Admin_DocPushByTag' does not contain a definition for
'CtlCategoryList' and no extension method 'CtlCategoryList' accepting a first argument 
of type 'Documents_Admin_DocPushByTag' could be found (are you missing a using directive
or an assembly reference?)

Each of these error messages refer to server controls in my markup. It's as if the mark-up is not getting parsed? When I edit one of the code behind files and type this. to see what intellisense recognizes, these controls don't appear. The event handlers do (but that must be because they are defined in the code behind file). As far as I can tell, the CodeFile and Inherits Page attributes are correct (and unchanged from the ASP.NET project from whence they came). I'm mystified what is causing this problem. Any ideas? TIA.

+2  A: 

I think you'd have a lot easier conversion adding the System.Web.Mvc assemblies to your current project and updating the web.config file and global.asax.

You have to make sure your current application is a web application (not site) project. If it isn't convert it and make sure it compiles first.

Kyle West
This sounds promising. Indeed it is a web site project.
Decker
+1  A: 

check out how scott hanselman does it:
http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx

basicallly, you'd use ignoreroute to exclude all of your webforms from being routed to an mvc handler

Joel Martinez
Thanks. I did see Scott's article. However, my issue is happening during build. Not during routing.
Decker