Reputation: 60711
In my solution, rather than referencing DLL's for certain libraries, those projects have been included in my solution:
Rather than having to include the projects part of the solution, is it possible to either have them part of the build definition, or perhaps as pre-build event command line:
How do I include projects that need to be built for my solution without actually having them loaded in the solution?
Upvotes: 2
Views: 3717
Reputation: 851
I have all project in same solution that are not referenced and i build them by putting following command in pre-build event of startup project
"$(DevEnvDir)devenv" "$(SolutionDir)SolutionName.sln" /Rebuild $(ConfigurationName) /project "$(SolutionDir)ProjectFolder\ProjectFile.csproj"
Corrected!
"$(DevEnvDir)devenv" "$(SolutionPath)" /Rebuild $(ConfigurationName) /project "$(SolutionDir)YOUR_PROJECT_FOLDER\PROJECT_FILE.csproj"
Upvotes: 3
Reputation: 19330
You can work in 2 ways. You reference either other projects, or dlls in your project. And you can combine both. If you don't want some projects being build in the solution as not being part of the solution, you must pre-build them and point references to the output of the compilation process. And if you want them to be part of the solution but not compile, use Build Configuration Manager. You can use that to mark, which projects get built under that configuration, and which don't get built.
If you have a large solution, it is better to set output to an arbitrary bin or lib folder and reference from there as well. Make sure to set project build order in this case.
For a small solution, project reference will work fine. In this case, build order will establish itself.
The difference is performance - in case #1 - dll reference allows you to build single project. In case #2, building a single project will trigger chain of project compilations. In this case, you just wait longer each time. In a large solution this is detrimental for developers.
And last thing, if you have some DLLs that are not referenced but are used in your app by, lets say being loaded via reflection, you can use pre build or post build events to copy these into $(TargetDir)
Upvotes: 2