WebForms and ASP.NET MVC co-existence

前端 未结 2 836
被撕碎了的回忆
被撕碎了的回忆 2021-01-19 10:25

I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I\'ve done to make that happen is that I added a namespaces node to the WebForms

相关标签:
2条回答
  • 2021-01-19 11:07

    Add System.Web.Mvc in the compilation section,

    <compilation debug="true">
        <assemblies>
            <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            </assemblies>
    </compilation>
    
    0 讨论(0)
  • 2021-01-19 11:21

    It's easier to start with an MVC project, and then start adding WebForms pages.

    For your error, you will need to add references for the following assemblies:

    • System.Web.Mvc
    • System.Web.Routing
    • System.Web.Abstractions

    There will be much more to add in the web.config to get MVC working correctly. To get it all, I'd suggest creating an MVC project, and merging the web.config files.

    0 讨论(0)
提交回复
热议问题