Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish Web Application with Multiple Projects

I have an ASP.NET web application that consists of multiple ASP.NET Projects (in addition to multiple class libraries). Obviously one of the projects is the root project while the rest are sub projects (the detailed concept of this application structure is explained here). Each of the sub/child projects has its own directory and they all sit in a directory I called "Modules" under the root folder. Since IIS can deal with one project per application, all child projects will be treated as regular directories (upon run). Therefore, I modified the build output path for each of the child projects to "..\..\bin\" which is the root bin folder. That way, I have everything set up correctly. From Visual Studio perspective, I have the luxury of having different projects under one solution. And from the IIS perspective I have one project with one bin folder and one Web.Config file. Now it comes to publish. If I publish the root project (by right clicking on the project node --> publish) the published output will be that project only with no "Modules" folder. The resulting bin folder will also miss the sub projects output dlls. And that's expected. So I thought that the obvious way to fix this is to publish all my web projects (not only the root), having in mind that my sub projects publish path needs to be the "Modules" folder within the root project's publish path. All that worked great except for one essential problem. It turned out that each of the published sub projects has its own bin folder and consequently the root bin folder does not contain the output DLLs of the sub projects. So I figured, while Visual Studio lets me specify the output path of each project the way I want (as I mentioned I set it to "..\..\bin\"), the ClickOnce publish does not respect that and simply creates a bin folder for every sub project. Is there a way to specify the output path (the bin folder) of the ClickOnce publish procedure? If not, what would be an alternative solution?

like image 303
yazanpro Avatar asked Oct 30 '22 11:10

yazanpro


1 Answers

As you said you have multiple projects and one is the root project. So every project should have its own bin folder because it is a project not a sub folder of root project.

If sub project would not have a bin folder how it would know from where to load assemblies which are used in that project.

It is not a bad idea to have bin folder for each sub project.

like image 61
Mairaj Ahmad Avatar answered Nov 15 '22 07:11

Mairaj Ahmad