We have a solution created and maintained via VisualStudio2017 in which our .csprojs are placed inside virtual-folders like so:
Solution.sln
\- VirtualFolder1
\- Foo.Common.Bar.csproj -> Bar\bin
\- Foo.Common.Ping.csproj -> Ping\bin
\- Foo.Common.Pong.csproj -> Pong\bin
\- VirtualFolder2
\- Foo.Utils.Bar.csproj -> Utils.Bar\bin
\- Foo.Utils.Ping.csproj -> Utils.Ping\bin
\- Foo.Utils.Pong.csproj -> Utils.Pong\bin
As expected each and every .csproj file already contains a section which defines where the output path should be:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>[Bar/bin or Ping/bin etc]</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>[Bar/bin or Ping/bin etc]</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
We want to build all .Common .csproj and .Utils .csproj projects en-masse into their respective output folders without having to specify them in our msbuild-script (which is invoked by JenkinsCI btw) one by one. To achieve that we have tried:
<ItemGroup>
<ALL_PROJECTS_IN_SOLUTION_EXCEPT_TESTS
Include="$(_codeFolderpath)\**\*.csproj"
/>
</ItemGroup>
<MSBuild
Projects="@(ALL_PROJECTS_IN_SOLUTION_EXCEPT_TESTS)"
Properties="Platform=$(Platform);Configuration=$(Configuration)"
BuildInParallel="true"
/>
This however results in the following errors for all our .csproj:
The OutputPath property is not set for project [...].csproj
This is strange given the fact that the OutputPath is defined in our .csproj files (as shown above).
If we specify the 'Output' property then the problem goes away of course however what we really want is these projects to output themselves into their respective appropriate output directories (shown above). How can one go about achieving this?