Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
5338de8f
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5338de8f
编写于
3月 21, 2017
作者:
C
CyrusNajmabadi
提交者:
GitHub
3月 21, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18013 from dotnet/merges/dev15.1.x-to-master-20170321-070004
Merge dev15.1.x to master
上级
cabb70bf
ba9c82a8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
47 addition
and
15 deletion
+47
-15
src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs
...mplementation/ProjectSystem/VisualStudioProjectTracker.cs
+45
-13
src/VisualStudio/Core/Impl/CodeModel/InternalElements/AbstractCodeElement.cs
...re/Impl/CodeModel/InternalElements/AbstractCodeElement.cs
+2
-2
未找到文件。
src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs
浏览文件 @
5338de8f
...
...
@@ -761,14 +761,11 @@ private void OutputToOutputWindow(string message)
projectContext
.
AddAdditionalFile
(
sourceFile
.
Path
);
}
var
metadataReferences
=
commandLineArguments
.
ResolveMetadataReferences
(
project
.
CurrentCompilationOptions
.
MetadataReferenceResolver
).
AsImmutable
();
var
addedProjectReferences
=
new
HashSet
<
string
>();
foreach
(
var
projectReferencePath
in
projectInfo
.
ReferencedProjectFilePaths
)
{
// NOTE: ImmutableProjects might contain projects for other languages like
// Xaml, or Typescript where the project file ends up being identical.
var
referencedProject
=
ImmutableProjects
.
SingleOrDefault
(
p
=>
(
p
.
Language
==
LanguageNames
.
CSharp
||
p
.
Language
==
LanguageNames
.
VisualBasic
)
&&
StringComparer
.
OrdinalIgnoreCase
.
Equals
(
p
.
ProjectFilePath
,
projectReferencePath
));
var
referencedProject
=
TryFindExistingProjectForProjectReference
(
projectReferencePath
,
metadataReferences
);
if
(
referencedProject
==
null
)
{
referencedProject
=
GetOrCreateProjectFromArgumentsAndReferences
(
...
...
@@ -809,15 +806,9 @@ private void OutputToOutputWindow(string message)
}
}
foreach
(
var
reference
in
commandLineArguments
.
ResolveMetadataReferences
(
project
.
CurrentCompilationOptions
.
MetadataReferenceResolver
)
)
foreach
(
var
reference
in
metadataReferences
)
{
// Some references may fail to be resolved - if they are, we'll still pass them
// through, in case they come into existence later (they may be built by other
// parts of the build system).
var
unresolvedReference
=
reference
as
UnresolvedMetadataReference
;
var
path
=
unresolvedReference
==
null
?
((
PortableExecutableReference
)
reference
).
FilePath
:
unresolvedReference
.
Reference
;
var
path
=
GetReferencePath
(
reference
);
if
(
targetPathsToProjectPaths
.
TryGetValue
(
path
,
out
var
possibleProjectReference
)
&&
addedProjectReferences
.
Contains
(
possibleProjectReference
))
{
...
...
@@ -844,6 +835,47 @@ private void OutputToOutputWindow(string message)
return
(
AbstractProject
)
projectContext
;
}
private
AbstractProject
TryFindExistingProjectForProjectReference
(
string
projectReferencePath
,
ImmutableArray
<
MetadataReference
>
metadataReferences
)
{
// NOTE: ImmutableProjects might contain projects for other languages like
// Xaml, or Typescript where the project file ends up being identical.
AbstractProject
candidate
=
null
;
foreach
(
var
existingProject
in
ImmutableProjects
)
{
if
(
existingProject
.
Language
!=
LanguageNames
.
CSharp
&&
existingProject
.
Language
!=
LanguageNames
.
VisualBasic
)
{
continue
;
}
if
(!
StringComparer
.
OrdinalIgnoreCase
.
Equals
(
existingProject
.
ProjectFilePath
,
projectReferencePath
))
{
continue
;
}
// There might be multiple projects that have the same project file path and language in the case of
// cross-targeted .NET Core project. To support that, we'll try to find the one with the output path
// that matches one of the metadata references we're trying to add. If we don't find any, then we'll
// settle one with a matching project file path.
candidate
=
candidate
??
existingProject
;
if
(
metadataReferences
.
Contains
(
mr
=>
StringComparer
.
OrdinalIgnoreCase
.
Equals
(
GetReferencePath
(
mr
),
existingProject
.
BinOutputPath
)))
{
return
existingProject
;
}
}
return
candidate
;
}
private
static
string
GetReferencePath
(
MetadataReference
mr
)
{
// Some references may fail to be resolved - if they are, we'll still pass them
// through, in case they come into existence later (they may be built by other
// parts of the build system).
return
mr
is
UnresolvedMetadataReference
umr
?
umr
.
Reference
:
((
PortableExecutableReference
)
mr
).
FilePath
;
}
private
static
string
GetLanguageOfProject
(
string
projectFilename
)
{
switch
(
PathUtilities
.
GetExtension
(
projectFilename
))
...
...
src/VisualStudio/Core/Impl/CodeModel/InternalElements/AbstractCodeElement.cs
浏览文件 @
5338de8f
...
...
@@ -152,7 +152,7 @@ public EnvDTE.TextPoint StartPoint
{
get
{
var
point
=
FileCodeModel
.
EnsureEditor
(()
=>
CodeModelService
.
GetStartPoint
(
LookupNode
()
));
var
point
=
CodeModelService
.
GetStartPoint
(
LookupNode
(
));
if
(
point
==
null
)
{
return
null
;
...
...
@@ -178,7 +178,7 @@ public EnvDTE.TextPoint EndPoint
public
virtual
EnvDTE
.
TextPoint
GetStartPoint
(
EnvDTE
.
vsCMPart
part
)
{
var
point
=
FileCodeModel
.
EnsureEditor
(()
=>
CodeModelService
.
GetStartPoint
(
LookupNode
(),
part
)
);
var
point
=
CodeModelService
.
GetStartPoint
(
LookupNode
(),
part
);
if
(
point
==
null
)
{
return
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录