简体   繁体   中英

Is it a bad practice to share the same build output folder between projects of a solution?

I'm thinking of this: If projects share the same output folder, I guess there would be situations when some file could be get replaced by the build process by other version of the same file, causing issues. Am I right?

I'd say that it's not a good idea, but I would like to ask you for an authoritive answer.

In my opinion, it is always better to have a separate output build folder for each project. Firstly, to avoid things like overwriting as you said and secondly, just from the context alone, projects should be treated separately, be it config files or builds. If you later also have CI/CD pipelines in combination with builds, these are also provided separately and via scripts you can then gather the necessary configurations accordingly or also copy eg static files (such as Javascript frontend builds) into the respective project folder, which is responsible eg for providing a UI (eg via .NET ASP and static files).

What you can also do if you can't avoid it for some reason, is to create at least a "subfolder" for the respective projects in relation to the builds, eg /bin/build/myProjectOneBuild and /bin/build/myProjectTwoBuild .

Best regards

Depends on what you want to do. Unrelated projects generally shouldn't output to the same directory because, as you say, it could lead to eg dependencies of different versions overwriting each other. However if you have a bunch of projects which logically belong together, like multiple executables which are to be distributed together or just form a set of tools together, or a program which uses a plugin architecture and each plugin is its own project, then it does make sense and is even convenient to have one directory. In such case there should also not be a risk with overwriting since eg plugin dependencies should then all have the same version anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM