visual studio 2010 conditional references
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.
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="http://schemas.microsoft.com/developer/msbuild/2003" >
<PropertyGroup>
<!-- ... -->
</PropertyGroup>
<Choose>
<When Condition=" '$(Configuration)'=='Debug' ">
<ItemGroup>
<ProjectReference Include="..stuffMyStuff.csproj">
<Project>{4c7bbe47-8d84-45d4-95f0-f640ba59563c}</Project>
<Name>MyStuff</Name>
</ProjectReference>
</ItemGroup>
</When>
<When Condition=" '$(Configuration)'=='Retail' ">
<ItemGroup>
<Reference Include="MyStuff.dll" />
</ItemGroup>
</When>
</Choose>
<!-- Rest of Project -->
</Project>
MSDN has more information about using conditional constructs.
You might want to have a look at NuGet:
NuGet
NuGet is a free, open source developer focused package management system for the .NET platform intent on simplifying the process of incorporating third party libraries into a .NET application during development .
(where you would be the third party yourself in this case)
Note: This would not give you conditional references, but it would ease updating the common components.
链接地址: http://www.djcxy.com/p/43692.html上一篇: 删除* .sdf文件