Max*_*ler 33 tfs build-process visual-studio-2008
我知道我可以将HintPath添加到外部DLL,以帮助Visual Studio/TFS在构建时找到它.
我想知道的是......是否可以添加多个HintPath?
例如......开发人员将DLL放在一个地方,我们在服务器上的不同位置执行这些DLL的GetLatest,因此需要多个HintPath.
你怎么看,世界?
Ale*_*lex 38
对不起,你不能使用多个HintPath.Visual Studio/MSBuild仅采用最后一个 <HintPath>定义,将忽略任何以前的定义.在VS2010和VS2012中确认.
Max*_*ler 14
这个答案不再有效.正如Sardaukar的评论所说,Visual Studio总是盲目地使用最后一个HintPath.亚历克斯的回答支持这一点.
好的.这次我比Stackoverflow快.我试图添加它,它似乎工作正常.
因此可以使用多个HintPath.
当你有这个:
<Reference Include="System.ComponentModel.Composition.Codeplex">
<HintPath>..\..\..\MEF2_Preview2\bin\System.ComponentModel.Composition.Codeplex.dll</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)
你可以简单地添加更多的提示路径:
<Reference Include="System.ComponentModel.Composition.Codeplex">
<HintPath>..\..\..\MEF2_Preview2\bin\System.ComponentModel.Composition.Codeplex.dll</HintPath>
<HintPath>D:\MEF\System.ComponentModel.Composition.Codeplex.dll</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)
小智 8
您可以使用环境变量.例如
<Reference Include="System.ComponentModel.Composition.Codeplex">
<HintPath>$(PathToDLLs)\MEF2_Preview2\bin\System.ComponentModel.Composition.Codeplex.dll</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)
使用条件,您可以:
<Reference Include="TheAssembly">
<HintPath Condition="Exists('..\My\Assembly\Path')">..\My\Assembly\Path\TheAssembly.dll</HintPath>
<HintPath Condition="Exists('..\..\My\Assembly\Path')">..\..\My\Assembly\Path\TheAssembly.dll</HintPath>
<HintPath Condition="Exists('..\..\..\My\Assembly\Path')">..\..\..\My\Assembly\Path\TheAssembly.dll</HintPath>
<HintPath Condition="Exists('..\..\..\..\My\Assembly\Path')">..\..\..\..\My\Assembly\Path\TheAssembly.dll</HintPath>
<HintPath Condition="Exists('..\..\..\..\..\My\Assembly\Path')">..\..\..\..\..\My\Assembly\Path\TheAssembly.dll</HintPath>
<HintPath Condition="Exists('..\..\..\..\..\..\My\Assembly\Path')">..\..\..\..\..\..\My\Assembly\Path\TheAssembly.dll</HintPath>
<HintPath Condition="Exists('..\..\..\..\..\..\..\My\Assembly\Path')">..\..\..\..\..\..\..\My\Assembly\Path\TheAssembly.dll</HintPath>
etc...
</Reference>
Run Code Online (Sandbox Code Playgroud)
将使用 Condition 评估为 true 的最后一个 HintPath。
| 归档时间: |
|
| 查看次数: |
15693 次 |
| 最近记录: |