c# - How to add Assembly-References on a per-configuration-basis -
i'm looking add debug code windows phone project. debug code drag in debug class library references (nunit helpers) , wcf service client references, , i'd not have these referenced in release build.
can suggest way can add assembly-reference debug, not have appear in release?
i've seen on connect - https://connect.microsoft.com/visualstudio/feedback/details/106011/allow-adding-assembly-references-on-a-per-configuration-basis-debug-release - it's marked "postponed"
there's request on visual studio's uservoice marked closed
won't fix
here: https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/2062487-allow-assembly-references-to-switch-based-on-confi
both cases using msbuild condition
, you've once configure csproj
, forget this.
first: using condition
- create new project debugonlyhelpers
- reference debug-specific helpers in project
- specify condition in
csproj
file need filter references:
<projectreference include="debugonlyhelpers.csproj" condition=" '$(configuration)' == 'debug' "
second: using condition
choose/when:
<choose> <when condition=" '$(configuration)'=='debug' "> <itemgroup> <reference include="nunit.dll" /> <reference include="standard.dll" /> </itemgroup> </when> <otherwise> <itemgroup> <reference include="standard.dll" /> </itemgroup> </otherwise> </choose>
Comments
Post a Comment