Given a Solution where:
开发者_如何学Go- Project P1 has a reference to P2
- P2 has a reference to P3
- P3 has reference to P4
When you call msbuild this way:
msbuild.exe /v:m "c:\mysolution\p1\p1.csproj"
msbuild checks all project dependencies is builds dependencies if necessary. The typical output is:
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
P4 -> c:\mysolution\P4\bin\Debug\P4.dll
p3 -> c:\mysolution\p3\bin\Debug\p3.dll
p2 -> c:\mysolution\p2\bin\Debug\p2.dll
p1 -> c:\mysolution\p1\bin\Debug\p1.dll
In my case, I know the dependencies exist and are all right.
Is there a way to build only project p1.csproj
without verifying dependencies? The solution can be with msbuild or with something else.
you can pass /p:BuildProjectReferences=false
to msbuild, which will skip build project refence..
but this has one limitation, if your solution configuration and referenced project's configuration is mismatch, msbuild will failed to resolve referenced project's target output file...
here is a free vs extension package, you can download and try http://visualstudiogallery.msdn.microsoft.com/98de4058-8dc7-435b-9e01-c0f71dace808
vs package: Sharp Build Utility
I'm the author of this extension, i have the same requirement in current work, enjoy this tool...
essentially, this extension can handle above case, which will make a shadow copy of your build project file, change all project reference to dll file reference, and launch msbuild with the shadow project file.
What's the goal (why do you care)?
You could use assembly references rather than project references (but beware debug v release path differences).
Perhaps you could use the Configuration Manager in Visual Studio, and uncheck all the projects but the one you want to build.
Check out Microsoft's best practices for structuring solutions and projects:
Microsoft Patterns & Practices: Structuring Solutions and Projects
What you currently have is a is a single solution. This is the ideal case which should be used whenever possible. However, a single solution might turn out to be impractical for very large solutions like yours.
You might want to consider to partition the solution, i.e. use separate solutions for partitions of the dependency tree. Or you might even consider to use a so-called multi-solution. Check out the linked article to see about the consequences and drawbacks of such a change. Maybe using faster hardware might be the preferable option.
You should check out a product called OpenMake. My lead build engineer tells me they have done alot with dependency examination and build parallelization.
OpenMake
精彩评论