Publish a web application with multiple projects

I have an ASP.NET web application that consists of several ASP.NET projects (in addition to several class libraries). Obviously, one of the projects is the root project, and the rest are subprojects (a detailed diagram of this structure is explained here ). Each of the child projects has its own directory, and they all sit in the directory that I call "Modules" in the root folder. Since IIS can work with one project for each application, all child projects will be considered as normal directories (after launch). Therefore, I changed the assembly output path for each of the child projects to " ..\..\bin\ ", which is the root bin folder. So I set everything up correctly. From the point of view of Visual Studio, I have the luxury of having different projects within the same solution. And from an IIS perspective, I have one project with a bin one folder and one Web.Config file. Now it's about publishing. If I publish the root project (by right-clicking on the project node β†’ publication), the published output will be such a project only without the "Modules" folder. The resulting bin folder will also skip the output DLL projects. And it was expected. Therefore, I thought that the obvious way to fix this was to publish all my web projects (and not just the root), bearing in mind that my paths for publishing subprojects should be the β€œModules” folder in the path for publishing the root project. All of this worked great, except for one significant issue. It turned out that each of the published subprojects has its own bin folder, and therefore, the root bin folder does not contain output DLL subprojects. So I decided that although Visual Studio allows me to specify the output path of each project the way I want (since I mentioned that I set it to " ..\..\bin\ "), ClickOnce publishing does not respect this and just creates bin folder for each subproject. Is there a way to specify the output path (bin folder) of the ClickOnce publishing procedure? If not, what will be the alternative solution?

+5
source share
2 answers

As you said, you have several projects , and one is the root project. Therefore, each project must have its own bin folder, because this project not a sub folder of root project .

If the sub project does not have a bin folder, how will it know where to load the assemblies that are used in this project .

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

+1
source

The answer here may solve your problem. By adding the following attributes to your .csproj file (modified from the linked answer), you can tell ClickOnce to include additional content in the output directory:

 <ItemGroup> <Content Include="bin\**\*.*" /> </ItemGroup> 

Another answer given here allows you to recursively include in your project output of additional content that is outside your project folder, which can be applied here; from the perspective of the root project, another project is outside its folder. However, I'm not sure if ClickOnce will ignore this or not.

 <Content Include="..\..\MyContentFiles\**"> <Link>%(RecursiveDir)%(Filename)%(Extension)</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> 
+1
source

Source: https://habr.com/ru/post/1240789/


All Articles