参考Dll基于Visual Studio版本

时间:2015-08-25 16:41:58

标签: c# visual-studio-2012 visual-studio-2013

有没有办法根据Visual Studio的版本(dll2012)有条件地引用2013?如果我在VS2012,我会添加dll1,如果我在VS2013,我会添加dll2作为参考

我尝试了Condition="'$(Configuration)' == 'V12 Release'"之类的东西,但它似乎没有起作用:

<Reference Include="Microsoft.VisualStudio.ExtensionManager, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" Condition="'$(Configuration)' == 'V11 Release'">
  <HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.ExtensionManager\v4.0_11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.ExtensionManager.dll</HintPath>
</Reference>

<Reference Include="Microsoft.VisualStudio.ExtensionManager, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" Condition="'$(Configuration)' == 'V12 Release'">
  <HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.ExtensionManager\v4.0_12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.ExtensionManager.dll</HintPath>
</Reference>

有办法解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

尝试这样的事情:

<Reference Include="Microsoft.TeamFoundation.Client, Version=11.0.0.0, 
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, 
processorArchitecture=MSIL" Condition="'$(Configuration)' == 'VisualStudio_2012' OR 
'$(Configuration)' == 'Debug' OR '$(Configuration)' == 'Release'"/>