I've been trying 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.
我一直在尝试使用现有的ASP.NET Webforms应用程序并将其转换为混合,以便继续,我们可以做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:
为此,我创建了一个ASP.NET MVC应用程序,并开始从包含webforms的ASP.NET webforms项目中复制一些文件夹。我在构建生成的项目时出现问题,导致此表单出现数百个编译错误:
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.
这些错误消息中的每一个都引用我的标记中的服务器控件。这就好像标记没有被解析?当我编辑其中一个代码后面的代码并输入它。要了解intellisense识别的内容,这些控件不会出现。事件处理程序可以(但必须是因为它们是在代码隐藏文件中定义的)。据我所知,CodeFile和Inherits Page属性是正确的(并且从它们来自的ASP.NET项目中保持不变)。我对导致这个问题的原因感到困惑。有任何想法吗? TIA。
2 个解决方案
#1
4
check out how scott hanselman does it:
http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx
看看scott hanselman是如何做到的: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
basicallly,您将使用ignoreroute将所有webforms排除在路由到mvc处理程序之外
#2
3
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.
我认为你可以更容易地将System.Web.Mvc程序集添加到当前项目并更新web.config文件和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.
您必须确保当前的应用程序是Web应用程序(而非站点)项目。如果它没有转换它并确保它首先编译。
#1
4
check out how scott hanselman does it:
http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx
看看scott hanselman是如何做到的: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
basicallly,您将使用ignoreroute将所有webforms排除在路由到mvc处理程序之外
#2
3
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.
我认为你可以更容易地将System.Web.Mvc程序集添加到当前项目并更新web.config文件和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.
您必须确保当前的应用程序是Web应用程序(而非站点)项目。如果它没有转换它并确保它首先编译。