使用 Nuget 打包 ASP.NET MVC 应用程序

发布于 2024-11-27 02:50:29 字数 228 浏览 0 评论 0原文

有没有人尝试使用 Nuget 打包整个 ASP.NET MVC 应用程序并且它对他有用吗?我有一堆控制器、视图、助手和实用程序,我想将它们引入到另一个 MVC 项目中。

问题是,路线不起作用,我不知道它们是否应该起作用。问题是,我们引入的包的项目有自己的 global.asax.cs 和自己的路由。它如何与我们当前项目的 global.asax 及其路线结合起来?

因此,如果有人有此类软件包的经验,请回复。

Has anyone tried packing an entire ASP.NET MVC application with Nuget and did it work for him? I have a bunch of controllers, views, helpers and utilities that I would like to bring in into another MVC project.

The problem is, routes don't work and I don't whether they should or not. The thing is, the project for the package we brought in had its own global.asax.cs and its own routes. How does that get combined with our current project's global.asax and its routes?

So if anyone had any experience with such packages, please reply.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

懷念過去 2024-12-04 02:50:29

您应该尝试使用 MVC 区域功能来允许从多个位置注册路由。要查看其外观,请右键单击 MVC 项目并选择“添加/区域”;然后查看创建的 AreaRegistration 文件。

更新:使用 WebActivator 提供了另一种在启动时执行代码的方法,而无需修改 global.asax。

You should try to use the MVC Area feature to allow routes to be registered from multiple places. To see what that looks like, right click an MVC project and choose Add / Area; then look at the AreaRegistration file that gets created.

UPDATE: using WebActivator provides another approach to executing code at startup without having to modify global.asax.

苏璃陌 2024-12-04 02:50:29

您的路线不会被合并,因此您需要自己组合路线才能完成此操作。如果您想将它们分开,您可以使用具有自己的路线的区域,但如果您只是拉入一堆控制器和视图,则需要编辑项目中的路线,以便它们在新应用程序中有意义。

Your routes will not get merged so you will need to combine the routes yourself to make this work. You could use areas which have their own routes if you wanted to keep them separate but if you are just pulling in a bunch of controllers and views you'll need to edit the routes in your project so they make sense in the new application.

妥活 2024-12-04 02:50:29

有一个可编写脚本的应用程序可以帮助您复制所需的文件,请参阅:
https://nugetpackager.codeplex.com

这适用于区域/Webactivator 设置。

There is a scriptable application that can help you with copying the required files, see:
https://nugetpackager.codeplex.com

This work well with an Area / Webactivator setup.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文