开发者

Batch Build VS2008 Solution

开发者 https://www.devze.com 2023-01-13 18:12 出处:网络
I have a solution with 4 projects inside.What I want to be able to do is to change the order of the batch build (right-click solution Batch Build...).I have configured the Build Order, but this seems

I have a solution with 4 projects inside. What I want to be able to do is to change the order of the batch build (right-click solution Batch Build...). I have configured the Build Order, but this seems to make no difference.

Currently, it seems to just list them in the order they appear in the solution explorer, but they have dependencies of either other in a different order. For example:

Solution
   - Project1
   - Project2
   - Project3
   - Project4

But the 开发者_如何学Godependencies mean it needs to build in this order:

Solution
   - Project4
   - Project2
   - Project3
   - Project1

Is this possible and, if so, how?


Did you try Project Dependencies? Right click on your solution, choose Project Dependencies, right below Build Order. It let's you choose which projects depend on which. This affects the build order so it shouldn't really make a difference.

How exactly do you determine that the build order is not correct? One way would be to check the output pane when you do a full compile. If the order is correct here then the order isn't wrong, it's just that your dlls aren't being copied into the right folders at the right time.

How are the projects dependent, by library reference? When adding references between project, make sure you're using the Project tab, and not browsing to the dll because then you need to copy the dll between directories after compile.


Are these C++ or C# projects? If they're C++ projects, are they dependent on the final output (e.g. .LIB files)? Or are they dependent on intermediate files (.H files generated from .IDL files, e.g.)?

Visual Studio will parallelize C++ projects, except at the final linking stage, where it'll deal with the dependencies. If you've got intermediate dependencies, you'll need to configure these appropriately, so that it knows not to parallelize those steps.


This should explain everything... Like Martin said, you just need to change your project dependencies, because VS is thankfully smart enough to figure out the build order based on them. That's why you can't have circular references in your project dependencies... VS complains because it knows it won't be able to satisfy the requirements of both projects.

Batch Build VS2008 Solution

UPDATE

The Project Dependencies definitely determine the build order. Can you post a zip of your solution and projects? I need to see this for myself. :) But for kicks, I made a project like what you have outlined:

Here are my project dependencies:

Project 1 - main app

Batch Build VS2008 Solution

Project 2 - depends on Project 4

Batch Build VS2008 Solution

Project 3 - depends on Project 2

Batch Build VS2008 Solution

Project 4 - no dependencies

Batch Build VS2008 Solution

My batch build screen:

Batch Build VS2008 Solution

And my output window -- note the build order. Although my Project 1 is really named StackOverflow_BatchBuild, Project 2 was not built first -- Project 4 was.

------ Build started: Project: Project4, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Project4.dll /target:library Class1.cs Properties\AssemblyInfo.cs

Compile complete -- 0 errors, 0 warnings
Project4 -> C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project4\bin\Debug\Project4.dll
------ Build started: Project: Project2, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project4\bin\Debug\Project4.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Project2.dll /target:library Class1.cs Properties\AssemblyInfo.cs

Compile complete -- 0 errors, 0 warnings
Project2 -> C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project2\bin\Debug\Project2.dll
------ Build started: Project: Project3, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project2\bin\Debug\Project2.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Project3.dll /target:library Class1.cs Properties\AssemblyInfo.cs

Compile complete -- 0 errors, 0 warnings
Project3 -> C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project3\bin\Debug\Project3.dll
------ Build started: Project: StackOverflow_BatchBuild, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project3\bin\Debug\Project3.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\StackOverflow_BatchBuild.exe /resource:obj\Debug\StackOverflow_BatchBuild.Properties.Resources.resources /target:winexe Form1.cs Form1.Designer.cs Program.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs

Compile complete -- 0 errors, 0 warnings
StackOverflow_BatchBuild -> C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\bin\Debug\StackOverflow_BatchBuild.exe
========== Build: 4 succeeded or up-to-date, 0 failed, 0 skipped ==========
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号