Stu*_*art 13 .net c# visual-studio-2010 visual-studio windows-phone-7
我目前正在寻找一些仅调试代码到Windows Phone项目.这个调试代码将拖入一些调试类库引用(nunit helpers)和一些WCF服务客户端引用,我真的希望在发布版本中没有这些引用.
任何人都可以建议我可以添加一个Assembly-Reference来调试,但不会让它出现在发布中吗?
我在Connect上看过这个 - https://connect.microsoft.com/VisualStudio/feedback/details/106011/allow-adding-assembly-references-on-a-per-configuration-basis-debug-release-但它是标记为"推迟"
有一个关于Visual Studio的UserVoice的请求,但被标记为Closed为Won't Fix这里:https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/2062487-allow-assembly-references-to-switch-based -on-CONFI
sll*_*sll 13
两种情况都使用MSBuild Condition,你曾经配置csproj并忘记了这一点.
第一:使用Condition
csproj文件中指定需要过滤引用的条件:<ProjectReference
Include="DebugOnlyHelpers.csproj"
Condition=" '$(Configuration)' == 'DEBUG' "
Run Code Online (Sandbox Code Playgroud)
第二: 使用Condition连同选择/时:
<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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2743 次 |
| 最近记录: |