Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
R
roslyn
管理
动态
成员
标记
计划
议题
议题看板
里程碑
Wiki
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
构建
流水线
作业
流水线计划
产物
部署
发布
软件包库
容器镜像库
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
Show more breadcrumbs
麦壳饼
roslyn
提交
28af1ec7
提交
28af1ec7
编辑于
7年前
作者:
Sam Harwell
提交者:
GitHub
7年前
浏览文件
操作
下载
差异文件
Merge pull request #20833 from sharwell/fix-p2p-refassem
Add a workaround for P2P references with reference assemblies
上级
b3d03d67
e2cdc16f
No related branches found
No related tags found
无相关合并请求
变更
1
隐藏空白变更内容
行内
左右并排
显示
1 个更改的文件
src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs
+51
-5
51 个添加, 5 个删除
...mplementation/ProjectSystem/VisualStudioProjectTracker.cs
有
51 个添加
和
5 个删除
src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs
+
51
−
5
浏览文件 @
28af1ec7
...
...
@@ -430,18 +430,64 @@ internal bool TryGetProjectByBinPath(string filePath, out AbstractProject projec
lock
(
_gate
)
{
project
=
null
;
if
(
_projectsByBinPath
.
TryGetValue
(
filePath
,
out
var
projects
))
if
(
!
_projectsByBinPath
.
TryGetValue
(
filePath
,
out
var
projects
))
{
// If for some reason we have more than one referencing project, it's ambiguous so bail
if
(
projects
.
Length
==
1
)
// Workaround https://github.com/dotnet/roslyn/issues/20412 by checking to see if */ref/A.dll can be
// adjusted to */A.dll - only handles the default location for reference assemblies during a build.
if
(!
HACK_StripRefDirectoryFromPath
(
filePath
,
out
string
binFilePath
)
||
!
_projectsByBinPath
.
TryGetValue
(
binFilePath
,
out
projects
))
{
project
=
projects
[
0
];
return
true
;
return
false
;
}
}
// If for some reason we have more than one referencing project, it's ambiguous so bail
if
(
projects
.
Length
==
1
)
{
project
=
projects
[
0
];
return
true
;
}
return
false
;
}
}
private
static
readonly
char
[]
s_directorySeparatorChars
=
{
Path
.
DirectorySeparatorChar
,
Path
.
AltDirectorySeparatorChar
};
private
bool
HACK_StripRefDirectoryFromPath
(
string
filePath
,
out
string
binFilePath
)
{
const
string
refDirectoryName
=
"ref"
;
// looking for "/ref/" where:
// 1. the first / is a directory separator
// 2. 'ref' matches in a case-insensitive comparison
// 3. the second / is the last directory separator
var
lastSeparator
=
filePath
.
LastIndexOfAny
(
s_directorySeparatorChars
);
var
secondToLastSeparator
=
lastSeparator
-
refDirectoryName
.
Length
-
1
;
if
(
secondToLastSeparator
<
0
)
{
// Failed condition 3
binFilePath
=
null
;
return
false
;
}
if
(
filePath
[
secondToLastSeparator
]
!=
Path
.
DirectorySeparatorChar
&&
filePath
[
secondToLastSeparator
]
!=
Path
.
AltDirectorySeparatorChar
)
{
// Failed condition 1
binFilePath
=
null
;
return
false
;
}
if
(
string
.
Compare
(
refDirectoryName
,
0
,
filePath
,
secondToLastSeparator
+
1
,
lastSeparator
-
secondToLastSeparator
-
1
,
StringComparison
.
OrdinalIgnoreCase
)
!=
0
)
{
// Failed condition 2
binFilePath
=
null
;
return
false
;
}
binFilePath
=
filePath
.
Remove
(
secondToLastSeparator
,
lastSeparator
-
secondToLastSeparator
);
return
true
;
}
/// <summary>
...
...
This diff is collapsed.
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录