visual studio - Project-Conditions multiple lines -


i have project needs different versions of few dlls depending on release configuration.

usually following way:

<reference condition=" '$(configuration)|$(platform)' == 'v16release|anycpu' " include="microsoft.sharepoint.client.runtime, version=16.1.0.0, culture=neutral, publickeytoken=71e9bce111e9429c, processorarchitecture=msil">   <hintpath>..\packages\microsoft.sharepointonline.csom.16.1.5626.1200\lib\net45\microsoft.sharepoint.client.runtime.dll</hintpath>   <private>true</private> </reference> <reference condition=" '$(configuration)|$(platform)' == 'v16release|anycpu' " include="microsoft.sharepoint.client.runtime.windows, version=16.1.0.0, culture=neutral, publickeytoken=71e9bce111e9429c, processorarchitecture=msil">   <hintpath>..\packages\microsoft.sharepointonline.csom.16.1.5626.1200\lib\net45\microsoft.sharepoint.client.runtime.windows.dll</hintpath>   <private>true</private> </reference> 

and other build-configuration:

<reference condition=" '$(configuration)|$(platform)' == 'v15release|anycpu' " include="microsoft.sharepoint.client.runtime, version=15.1.0.0, culture=neutral, publickeytoken=71e9bce111e9429c, processorarchitecture=msil">   <hintpath>..\packages\microsoft.sharepointonline.csom.15.1.1626.1200\lib\net45\microsoft.sharepoint.client.runtime.dll</hintpath>   <private>true</private> </reference> <reference condition=" '$(configuration)|$(platform)' == 'v15release|anycpu' " include="microsoft.sharepoint.client.runtime.windows, version=15.1.0.0, culture=neutral, publickeytoken=71e9bce111e9429c, processorarchitecture=msil">   <hintpath>..\packages\microsoft.sharepointonline.csom.15.1.1626.1200\lib\net45\microsoft.sharepoint.client.runtime.windows.dll</hintpath>   <private>true</private> </reference> 

as can see, depending on release configuration, different dlls loaded.

while works, there more 2 packages. there way group conditions like:

<group condition=" '$(configuration)|$(platform)' == 'v15release|anycpu' ">   <reference.... />   <reference.... />   <reference.... />   <reference.... /> </group> 

so simple "if (left==right) {}" write in code?

if edit project in editor you'll see references in itemgroup can put condition on that, , have multiple groups different conditions:

<itemgroup condition=" '$(configuration)|$(platform)' == 'v15release|anycpu' ">   <reference.... />   <reference.... />   <reference.... />   <reference.... /> </itemgroup >  <itemgroup condition=" '$(configuration)|$(platform)' == 'v16release|anycpu' ">   <reference.... />   <reference.... />   <reference.... />   <reference.... /> </itemgroup > 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -