You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Dnn 7是否支持MVC模块开发?求相关开发文档链接

Dnn 7 MVC Module Development Support: What You Need to Know

Hey there! Let's clear this up right away: Dnn 7 does support MVC module development, but only starting with version 7.2. Earlier releases (7.0 and 7.1) don't include any MVC integration at all, which is probably why you struggled to find docs focused on Dnn 7 specifically.

Key Details to Keep in Mind

  • Framework Lock: Dnn 7.2's MVC support is tied directly to ASP.NET MVC 3—you can't use newer MVC versions (like 4 or higher) here, so make sure your project targets that framework.
  • Module Structure Differences: Unlike Dnn 8+, the MVC module structure in 7.2 is more constrained:
    • Controllers must inherit from DotNetNuke.Web.Mvc.Framework.Controllers.DnnController (not the later DnnMvcController you might see in 8+ docs)
    • Views follow standard ASP.NET MVC conventions, but need to live in a Views/{ControllerName} folder within your module
    • Your .dnn manifest file requires a specific MvcModule component to register controllers, like this:
      <components>
        <component type="MvcModule">
          <controllers>
            <controller name="Home" type="YourModule.Controllers.HomeController, YourModule" />
          </controllers>
        </component>
      </components>
      
  • Routing: Dnn handles routing automatically for MVC modules in 7.2—you don't need to manually register routes. Access your module's actions via paths like /DesktopModules/YourModuleName/Home/Index

Quick Development Walkthrough

  1. Set up a class library project targeting .NET Framework 4 (since Dnn 7.2 runs on this), then add references to DotNetNuke.dll, DotNetNuke.Web.Mvc.dll, and System.Web.Mvc.dll (version 3.0.0.0)
  2. Create a controller that inherits from DnnController and add your action methods (e.g., Index())
  3. Add corresponding views in the correct Views subfolder structure
  4. Configure your .dnn manifest with the MvcModule component to register your controller
  5. Compile, package your module (DLL + views + manifest), and install it on a Dnn 7.2+ site

Important Caveats

  • Dnn 7.2's MVC support is fairly basic compared to later versions—features like areas, advanced route customization, or integrated dependency injection aren't available here
  • Double-check your Dnn site's exact version: if it's pre-7.2, MVC modules won't work at all

内容的提问来源于stack exchange,提问作者Jacques

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:15:07