Search code examples
c#csprojsln-file

How to build a given csproj only on specified platform


I'm working on a project that generates bindings for a cross platform c library. The bindings are automatically generated for a specific platform. In my solution I have 3 projects.

  • Project.Windows.csproj
  • Project.Linux.csproj
  • Project.MacOs.csproj

How can I prevent the Linux and MacOs csproj from building when on windows.


Solution

  • You can set which projects need to be built at any place below:

    • The solution properties window > Configuration Properties
    • The build menu > Configuration Manager...