0

I have X projects in solution: AllPlatformProject1, AllPlatformProject2... ProjectOnlyForWindows1, OnlyForWindows2... ProjectNotLinux1, ProjectNotLinux2...

I want to exclude "OnlyForWindows" and "NotLinux", but how? I want to use xbuild and be able to do it for all targets.

2 Answers2

3

You can't do it with one sln. Usually people create multiple solutions, even in the same directory.

Everything.sln
WindowsCentric.sln
LinuxCentric.sln

something like that.

The "gotcha" is that......when you add a "reference by project", both projects need to be in the .sln file.

granadaCoder
  • 26,328
  • 10
  • 113
  • 146
1

Have you tried using different Configurations to pair with your targets and omit the configurations from the specific projects? Example:

Solution configurations :

 LinuxDebug
 LinuxRelease
 WindowsDebug 
 WindowsRelease

And then you tell the solution to omit the linux projects from the Windows* configurations and vice versa?

I'll admit, I haven't leveraged xbuild but this approach works in MSBuild if you are using solutions and not traversal proj files. In the case of Traversal proj files you can just add conditionals to the ItemGroup inclusions to omit projects based on a $() property.

Nick Nieslanik
  • 4,388
  • 23
  • 21