Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to make separate dlls with MVC project?

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.

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

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

like image 772
James123 Avatar asked Nov 03 '15 21:11

James123


Video Answer


2 Answers

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.

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:

How do you share scripts among multiple projects in one solution?

like image 165
Harsh Shah Avatar answered Oct 14 '22 19:10

Harsh Shah


Yes you can, just add the logic classes to other class library project (you can have as many as you want), then add references of those class librarys to the mvc project. Don't forget to import the classes after in your code

Edit: I'm assuming you are using Visual Studio, if yes, you can go to File -> Create Project, this will create another project in the same solution.

like image 31
Paulo Lima Avatar answered Oct 14 '22 19:10

Paulo Lima