简体   繁体   中英

conditional references in visual studio - how to define the customized variable

I have a project which should reference other projects done it this way:

 <Reference Include="referencedDll" Condition=" '$(Configuration)' == 'Debug' ">
  <HintPath>..\Resources\External DLLs\referencedDll.dll</HintPath>
</Reference>

this works fine and copies the dll just in case it is in debug. but I want it not to depend on debug/ release but some other variable definition

something like:

<Reference Include="referencedDll" Condition=" '$(ReleaseType)' == 'INTERNAL_RELEASE' ">
  <HintPath>..\Resources\External DLLs\referencedDll.dll</HintPath>
</Reference>

I did not find how to define the ReleaseType variable? + is there any way to use the same variable for both #if in the code and for conditional referencing?

I saw the option to use use

 Condition=" $(DefineConstants.Contains('INTERNAL_RELEASE'))"

but it did not work as I'd expect

I'm not completely sure if there is a way to do that in Visual studio. If you are running the build from msbuild directly you can use /P:ReleaseType=INTERNAL_RELEASE.

In my project I ended up changing Configuration property and instead of having it as Debug and Release I have more values like , DEV,QA,STAGE, etc...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM