Project reference conditional include with multiple conditions

C#IncludeConditionalCsprojBuildconfiguration

C# Problem Overview


Here's a snippet from my csproj file:

<ProjectReference Include="..\program_data\program_data.csproj" Condition="'$(Configuration)'=='Debug'">
      <Project>{4F9034E0-B8E3-448E-8794-CF9B9A5E7D46}</Project>
      <Name>program_data</Name>
</ProjectReference>

What I'd like to do is include program_data.dll for multiple build configurations, for example, both Release and Debug.

I tried doing the following

Condition="'$(Configuration)'=='Debug' || '$(Configuration)'=='Release'"

but Visual Studio chokes on this.

Is there a way I can do this, or must I have a separate <ProjectReference> for each build config?

C# Solutions


Solution 1 - C#

You should use Or, not ||:

Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCharlie SaltsView Question on Stackoverflow
Solution 1 - C#OdedView Answer on Stackoverflow