Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
e75f8da4
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,发现更多精彩内容 >>
未验证
提交
e75f8da4
编写于
6月 25, 2020
作者:
M
msftbot[bot]
提交者:
GitHub
6月 25, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #45316 from jasonmalinowski/fix-project-references-to-web-projects
Don't fetch output paths for Intellisense projects
上级
6a7aa5fd
2210f339
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
45 addition
and
49 deletion
+45
-49
src/VisualStudio/CSharp/Impl/LanguageService/CSharpLanguageService_ICSharpProjectHost.cs
...nguageService/CSharpLanguageService_ICSharpProjectHost.cs
+1
-3
src/VisualStudio/CSharp/Impl/ProjectSystemShim/CSharpProjectShim.cs
...Studio/CSharp/Impl/ProjectSystemShim/CSharpProjectShim.cs
+3
-8
src/VisualStudio/CSharp/Test/ProjectSystemShim/CSharpHelpers.cs
...sualStudio/CSharp/Test/ProjectSystemShim/CSharpHelpers.cs
+1
-4
src/VisualStudio/Core/Def/Implementation/ProjectSystem/Legacy/AbstractLegacyProject.cs
...lementation/ProjectSystem/Legacy/AbstractLegacyProject.cs
+33
-21
src/VisualStudio/TestUtilities2/ProjectSystemShim/VisualBasicHelpers/VisualBasicHelpers.vb
...rojectSystemShim/VisualBasicHelpers/VisualBasicHelpers.vb
+2
-3
src/VisualStudio/VisualBasic/Impl/LanguageService/VisualBasicPackage.IVbCompiler.vb
...ic/Impl/LanguageService/VisualBasicPackage.IVbCompiler.vb
+2
-5
src/VisualStudio/VisualBasic/Impl/ProjectSystemShim/VisualBasicProject.vb
.../VisualBasic/Impl/ProjectSystemShim/VisualBasicProject.vb
+3
-5
未找到文件。
src/VisualStudio/CSharp/Impl/LanguageService/CSharpLanguageService_ICSharpProjectHost.cs
浏览文件 @
e75f8da4
...
...
@@ -24,9 +24,7 @@ public void BindToProject(ICSharpProjectRoot projectRoot, IVsHierarchy hierarchy
projectName
,
hierarchy
,
this
.
SystemServiceProvider
,
this
.
Package
.
ComponentModel
.
GetService
<
IThreadingContext
>(),
this
.
HostDiagnosticUpdateSource
,
this
.
Workspace
.
Services
.
GetLanguageServices
(
LanguageNames
.
CSharp
).
GetService
<
ICommandLineParserService
>());
this
.
Package
.
ComponentModel
.
GetService
<
IThreadingContext
>());
projectRoot
.
SetProjectSite
(
project
);
}
...
...
src/VisualStudio/CSharp/Impl/ProjectSystemShim/CSharpProjectShim.cs
浏览文件 @
e75f8da4
...
...
@@ -6,13 +6,11 @@
using
System.Runtime.InteropServices
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.Editor.Shared.Utilities
;
using
Microsoft.CodeAnalysis.Host
;
using
Microsoft.VisualStudio.ComponentModelHost
;
using
Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim.Interop
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.Legacy
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.TaskList
;
using
Microsoft.VisualStudio.Shell.Interop
;
namespace
Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
...
...
@@ -51,17 +49,14 @@ private new OptionsProcessor VisualStudioProjectOptionsProcessor
string
projectSystemName
,
IVsHierarchy
hierarchy
,
IServiceProvider
serviceProvider
,
IThreadingContext
threadingContext
,
HostDiagnosticUpdateSource
hostDiagnosticUpdateSourceOpt
,
ICommandLineParserService
commandLineParserServiceOpt
)
IThreadingContext
threadingContext
)
:
base
(
projectSystemName
,
hierarchy
,
LanguageNames
.
CSharp
,
isVsIntellisenseProject
:
projectRoot
is
IVsIntellisenseProject
,
serviceProvider
,
threadingContext
,
externalErrorReportingPrefix
:
"CS"
,
hostDiagnosticUpdateSourceOpt
:
hostDiagnosticUpdateSourceOpt
,
commandLineParserServiceOpt
:
commandLineParserServiceOpt
)
externalErrorReportingPrefix
:
"CS"
)
{
_projectRoot
=
projectRoot
;
_serviceProvider
=
serviceProvider
;
...
...
src/VisualStudio/CSharp/Test/ProjectSystemShim/CSharpHelpers.cs
浏览文件 @
e75f8da4
...
...
@@ -8,7 +8,6 @@
using
System.Runtime.InteropServices
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.CSharp
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
;
using
Microsoft.CodeAnalysis.Host
;
using
Microsoft.CodeAnalysis.UnitTests
;
using
Microsoft.VisualStudio
;
...
...
@@ -39,9 +38,7 @@ public static CSharpProjectShim CreateCSharpProject(TestEnvironment environment,
projectSystemName
:
projectName
,
hierarchy
:
hierarchy
,
serviceProvider
:
environment
.
ServiceProvider
,
threadingContext
:
environment
.
ThreadingContext
,
hostDiagnosticUpdateSourceOpt
:
null
,
commandLineParserServiceOpt
:
new
CSharpCommandLineParserService
());
threadingContext
:
environment
.
ThreadingContext
);
}
public
static
CPSProject
CreateCSharpCPSProject
(
TestEnvironment
environment
,
string
projectName
,
params
string
[]
commandLineArguments
)
...
...
src/VisualStudio/Core/Def/Implementation/ProjectSystem/Legacy/AbstractLegacyProject.cs
浏览文件 @
e75f8da4
...
...
@@ -9,10 +9,8 @@
using
System.Linq
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.Editor.Shared.Utilities
;
using
Microsoft.CodeAnalysis.Host
;
using
Microsoft.VisualStudio.ComponentModelHost
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.EditAndContinue
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.TaskList
;
using
Microsoft.VisualStudio.LanguageServices.ProjectSystem
;
using
Microsoft.VisualStudio.Shell
;
...
...
@@ -42,6 +40,11 @@ internal abstract partial class AbstractLegacyProject : ForegroundThreadAffiniti
/// </summary>
private
readonly
string
_projectDirectory
=
null
;
/// <summary>
/// Whether we should ignore the output path for this project because it's a special project.
/// </summary>
private
readonly
bool
_ignoreOutputPath
;
private
static
readonly
char
[]
PathSeparatorCharacters
=
{
Path
.
DirectorySeparatorChar
,
Path
.
AltDirectorySeparatorChar
};
#
region
Mutable
fields
that
should
only
be
used
from
the
UI
thread
...
...
@@ -54,11 +57,10 @@ internal abstract partial class AbstractLegacyProject : ForegroundThreadAffiniti
string
projectSystemName
,
IVsHierarchy
hierarchy
,
string
language
,
bool
isVsIntellisenseProject
,
IServiceProvider
serviceProvider
,
IThreadingContext
threadingContext
,
string
externalErrorReportingPrefix
,
HostDiagnosticUpdateSource
hostDiagnosticUpdateSourceOpt
,
ICommandLineParserService
commandLineParserServiceOpt
)
string
externalErrorReportingPrefix
)
:
base
(
threadingContext
,
assertIsForeground
:
true
)
{
Contract
.
ThrowIfNull
(
hierarchy
);
...
...
@@ -79,6 +81,23 @@ internal abstract partial class AbstractLegacyProject : ForegroundThreadAffiniti
_projectDirectory
=
Path
.
GetDirectoryName
(
projectFilePath
);
}
if
(
isVsIntellisenseProject
)
{
// IVsIntellisenseProjects are usually used for contained language cases, which means these projects don't have any real
// output path that we should consider. Since those point to the same IVsHierarchy as another project, we end up with two projects
// with the same output path, which potentially breaks conversion of metadata references to project references. However they're
// also used for database projects and a few other cases where there there isn't a "primary" IVsHierarchy.
// As a heuristic here we'll ignore the output path if we already have another project tied to the IVsHierarchy.
foreach
(
var
projectId
in
Workspace
.
CurrentSolution
.
ProjectIds
)
{
if
(
Workspace
.
GetHierarchy
(
projectId
)
==
hierarchy
)
{
_ignoreOutputPath
=
true
;
break
;
}
}
}
var
projectFactory
=
componentModel
.
GetService
<
VisualStudioProjectFactory
>();
VisualStudioProject
=
projectFactory
.
CreateAndAddToWorkspace
(
projectSystemName
,
...
...
@@ -217,6 +236,15 @@ protected void RemoveFile(string filename)
protected
void
RefreshBinOutputPath
()
{
// These projects are created against the same hierarchy as the "main" project that
// hosts the rest of the code; if we query the IVsHierarchy for the output path
// we'll end up with duplicate output paths which can break P2P referencing. Since the output
// path doesn't make sense for these, we'll ignore them.
if
(
_ignoreOutputPath
)
{
return
;
}
if
(!(
Hierarchy
is
IVsBuildPropertyStorage
storage
))
{
return
;
...
...
@@ -271,22 +299,6 @@ private static Guid GetProjectIDGuid(IVsHierarchy hierarchy)
return
Guid
.
Empty
;
}
private
static
bool
GetIsWebsiteProject
(
IVsHierarchy
hierarchy
)
{
try
{
if
(
hierarchy
.
TryGetProject
(
out
var
project
))
{
return
project
.
Kind
==
VsWebSite
.
PrjKind
.
prjKindVenusProject
;
}
}
catch
(
Exception
)
{
}
return
false
;
}
/// <summary>
/// Map of folder item IDs in the workspace to the string version of their path.
/// </summary>
...
...
src/VisualStudio/TestUtilities2/ProjectSystemShim/VisualBasicHelpers/VisualBasicHelpers.vb
浏览文件 @
e75f8da4
...
...
@@ -3,7 +3,6 @@
' See the LICENSE file in the project root for more information.
Imports
System.IO
Imports
Microsoft.CodeAnalysis.VisualBasic
Imports
Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim.Framework
Imports
Microsoft.VisualStudio.LanguageServices.VisualBasic.ProjectSystemShim
Imports
Microsoft.VisualStudio.LanguageServices.VisualBasic.ProjectSystemShim.Interop
...
...
@@ -15,9 +14,9 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim.Vi
Return
New
VisualBasicProject
(
projectName
,
If
(
compilerHost
,
MockCompilerHost
.
FullFrameworkCompilerHost
),
environment
.
CreateHierarchy
(
projectName
,
projectBinPath
,
projectRefPath
:
=
Nothing
,
"VB"
),
isIntellisenseProject
:
=
False
,
environment
.
ServiceProvider
,
environment
.
ThreadingContext
,
commandLineParserServiceOpt
:
=
New
VisualBasicCommandLineParserService
())
environment
.
ThreadingContext
)
End
Function
Public
Function
CreateMinimalCompilerOptions
(
project
As
VisualBasicProject
)
As
VBCompilerOptions
...
...
src/VisualStudio/VisualBasic/Impl/LanguageService/VisualBasicPackage.IVbCompiler.vb
浏览文件 @
e75f8da4
...
...
@@ -2,9 +2,7 @@
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports
Microsoft.CodeAnalysis
Imports
Microsoft.CodeAnalysis.Editor.Shared.Utilities
Imports
Microsoft.CodeAnalysis.Host
Imports
Microsoft.CodeAnalysis.VisualBasic
Imports
Microsoft.VisualStudio.LanguageServices.Implementation.TaskList
Imports
Microsoft.VisualStudio.LanguageServices.VisualBasic.ProjectSystemShim
...
...
@@ -27,10 +25,9 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic
wszName
,
pVbCompilerHost
,
pProjHier
,
TypeOf
punkProject
Is
IVsIntellisenseProject
,
Me
,
ComponentModel
.
GetService
(
Of
IThreadingContext
),
hostDiagnosticUpdateSource
,
commandLineParserServiceOpt
:
=
Workspace
.
Services
.
GetLanguageServices
(
LanguageNames
.
VisualBasic
).
GetService
(
Of
ICommandLineParserService
))
ComponentModel
.
GetService
(
Of
IThreadingContext
))
End
Function
Public
Function
IsValidIdentifier
(
wszIdentifier
As
String
)
As
Boolean
Implements
IVbCompiler
.
IsValidIdentifier
...
...
src/VisualStudio/VisualBasic/Impl/ProjectSystemShim/VisualBasicProject.vb
浏览文件 @
e75f8da4
...
...
@@ -39,12 +39,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.ProjectSystemShim
Friend
Sub
New
(
projectSystemName
As
String
,
compilerHost
As
IVbCompilerHost
,
hierarchy
As
IVsHierarchy
,
isIntellisenseProject
As
Boolean
,
serviceProvider
As
IServiceProvider
,
threadingContext
As
IThreadingContext
,
Optional
hostDiagnosticUpdateSourceOpt
As
HostDiagnosticUpdateSource
=
Nothing
,
Optional
commandLineParserServiceOpt
As
ICommandLineParserService
=
Nothing
)
MyBase
.
New
(
projectSystemName
,
hierarchy
,
LanguageNames
.
VisualBasic
,
serviceProvider
,
threadingContext
,
"VB"
,
hostDiagnosticUpdateSourceOpt
,
commandLineParserServiceOpt
)
threadingContext
As
IThreadingContext
)
MyBase
.
New
(
projectSystemName
,
hierarchy
,
LanguageNames
.
VisualBasic
,
isIntellisenseProject
,
serviceProvider
,
threadingContext
,
"VB"
)
_compilerHost
=
compilerHost
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录