Domanda

At my workplace, there is a specific projects which has several dependencies before we can compile it. I'll describe it in more simpliar scenario:

Let's say we have projects : A,B,C,D

Regarding A,B, when compiling each one of these projects, we'll get a lib file ( static library ). Let's say that in order to compile project C, we need to compile project A,B. After we compile project C, it serves as a static library for project D. Then we compile project D to run the application.

We know that we have professional automated tools but my managers wants to compile these dependencies at once using MSBuild.

The projects are written in C++ and the only reference I've found in MSDN is for C# or VB.

What can I do ????????? Please help :)

È stato utile?

Soluzione

Assuming VS2012 as I can't rememeber what 2010 supported:

You can either set up a solution via the GUI and add projects to it and then set up dependencies via Right Click Solution -> choose "Project Dependencies..." and setup your dependencies. MSBuild can build sln files just fine.

Alternatively (and what we do) is manually edit the vcxproj files to specify their dependencies via project references in an item group. This means you don't need sln files, and just building any project will automatically build its references projects if necessary.

<ProjectReference Include="PathTo.vcxproj">
  <Project>GuidOfProject</Project>
  <Name>Name</Name>
  <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
  <LinkLibraryDependencies>false</LinkLibraryDependencies>
  <UseLibraryDependencyImports>false</UseLibraryDependencyImports>
</ProjectReference>

from your description, you'll probably want to set LinkLibraryDependencies to true, but you'll want to investigate those options...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top