是否有可能使与MVC项目单独的dll? [英] Is it possible to make separate dlls with MVC project?

查看:97
本文介绍了是否有可能使与MVC项目单独的dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Asp.net开发MVC5一个大项目。我们的模型和业务逻辑在不同的类库定义。现在我们需要另一个模块添加到现有的项目,但我们希望有一个单独的DLL。

We have a big project developed in Asp.net MVC5. Our models and business logic are defined in separate class libraries. Now we need to add another module to an existing project but we want a separate dll.

这个模块也分享最JavaScript的,css文件和其他文件。这是我们不想分开MVC项目的原因。

This module also shares the most javascripts, css files and other files. That is the reason we don't want to separate MVC project.

有什么,为什么我们可以创建模块基础上单独的DLL。所以我们不希望部署或接触其他DLL。

Is there any why we can create separate dll for module basis. so we don't want deploy or touch other dlls.

推荐答案

从你的描述,你说的那个项目的份额CSS和JS文件。这使我相信你是在谈论一个独立的MVC网站(可能较大的企业网站的一部分)。这可能是最简单的使用领域。如果你不熟悉的领域,请阅读以下内容: HTTPS ://msdn.microsoft.com/en-us/library/ee671793(VS.100)的.aspx

From your description, you say that the projects share CSS and JS files. This leads me to believe you are talking about a separate MVC website (possibly part of the larger corporate website). This can be easiest with the use of Areas. If you are not familiar with Areas, please read the following: https://msdn.microsoft.com/en-us/library/ee671793(VS.100).aspx

使用领域将要求您部署整个网站每次的地区之一变。当然,你也提到要避免这样做。

Of course using Areas will require you to deploy the whole site everytime one of the areas change, and you have mentioned that you want to avoid doing so.

如果你不想使用领域,而是要创建在同一个解决方案的另一个MVC项目,你可以轻松办到了。您可以右键单击该解决方案,增加新的项目> ASP.NET Web应用程序> MVC添加的项目。分享JS和这两个MVC项目之间的CSS文件,你必须创建一个新的解决方案文件夹(右键单击解决方案>添加新的解决方案文件夹),您的资源文件移动到该文件夹​​。内部解决方案中的每一个MVC项目,将添加现有项目,选择那些JS / CSS资源文件。如果更改CSS文件通过这种方式,它会反映在两个项目。

If you don't want to use areas, and instead want to create another MVC project in the same solution, you can do that easily too. You can right click on the solution, add new project > ASP.NET web application > MVC to add the project. To share JS and CSS files between these two MVC projects, you will have to create a new solution folder (right click solution > Add new solution folder), and move your resource files to that folder. Inside each MVC project in your solution, you will add existing items and select those js/css resource files. This way if you change the css file, it will be reflected in both the projects.

有关更多信息,请阅读以下内容:

For more information, read the following:

<一个href=\"http://stackoverflow.com/questions/8540292/how-do-you-share-scripts-among-multiple-projects-in-one-solution\">How你共享多个项目之间的脚本一个解决方案?

这篇关于是否有可能使与MVC项目单独的dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆