在解决方案目录中添加对程序集的引用时,有什么方法可以相对添加它,以便在检入和检出存储库时在项目中正确引用它?
解决方案扩展 Pavel Minaev 的原始评论 - Visual Studio 的 GUI 支持相对引用,并假设您的 .sln 是相对引用的根.因此,如果您有解决方案 C:\myProj\myProj.sln,则您在 C:\myProj\ 的子文件夹中添加的任何引用都会自动添加为相对引用.>
要在单独的目录中添加相对引用,例如 C:/myReferences/myDLL.dll,请执行以下操作:
编辑 <HintPath > 等于
..\..\myReferences\myDLL.dll
现在引用 C:\myReferences\myDLL.dll.
希望这会有所帮助.
When adding a reference to an assembly located within the solution directory, is there any way to add it relatively, so that when checked in and out of a repository it is referenced in projects correctly?
解决方案To expand upon Pavel Minaev's original comment - The GUI for Visual Studio supports relative references with the assumption that your .sln is the root of the relative reference. So if you have a solution C:\myProj\myProj.sln, any references you add in subfolders of C:\myProj\ are automatically added as relative references.
To add a relative reference in a separate directory, such as C:/myReferences/myDLL.dll, do the following:
Edit the < HintPath > to be equal to
<HintPath>..\..\myReferences\myDLL.dll</HintPath>
This now references C:\myReferences\myDLL.dll.
Hope this helps.
更多推荐
Visual Studio:相对程序集引用路径
发布评论