100

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?

1 Answer 1

161

You should use Or, not ||:

Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'"
Sign up to request clarification or add additional context in comments.

8 Comments

@Charlie - I have linked to the MSBuild conditionals documentation.
I noticed that, thanks. I find the MSDN library can be tricky unless you know what you're looking for.
If you want your reference work for both Release and Debug, and you don't have any other configurations, it is simpler to make your ProjectReference unconditional by removing the "Condition" attribute.
@Oleg I would imagine they have more than just Debug and Release, otherwise no need for the question. I have a few solutions that also have Debug MONO and Release MONO.
Can I have my own Condition? in case I only want to reference this library in case that condition is set? and if so how do I set it
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.