Visual Studio 2010 条件引用 [英] visual studio 2010 conditional references

本文介绍了Visual Studio 2010 条件引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!



We have multiple products here that shared some common libraries. These libraries are part of a separate solution (so they can be built by TFS independently), but the problem is during development, one has to modify the common library, compile it to binary, copy it to the common location, compile the product solution.


In order to avoid this actually I am wondering if its possible to have conditional references, so for a debug configuration, I would reference them as project references, while in release configuration they would be binary references.


你应该能够通过直接编辑项目文件来使用条件结构来做到这一点(VS IDE 不会为你做到这一点).

You should be able to do this with conditional constructs by editing the project file directly (VS IDE won't do this for you).


For example, you might do something like this using the "Choose" element:

<Project xmlns="" >
        <!-- ... --> 

        <When Condition=" '$(Configuration)'=='Debug' ">
                <ProjectReference Include="..stuffMyStuff.csproj">

        <When Condition=" '$(Configuration)'=='Retail' ">
                <Reference Include="MyStuff.dll" />

    <!-- Rest of Project -->

MSDN 有有关使用条件结构的更多信息.

这篇关于Visual Studio 2010 条件引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

登录 关闭
发送“验证码”获取 | 15天全站免登陆