Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
e9bee533
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,发现更多精彩内容 >>
提交
e9bee533
编写于
10月 17, 2018
作者:
D
Dustin Campbell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add failing test for #30174
上级
5b81420f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
151 addition
and
6 deletion
+151
-6
src/Workspaces/CoreTestUtilities/Resources/Issue30174/InspectedLibrary/InspectedClass.cs
...s/Resources/Issue30174/InspectedLibrary/InspectedClass.cs
+15
-0
src/Workspaces/CoreTestUtilities/Resources/Issue30174/InspectedLibrary/InspectedLibrary.csproj
...urces/Issue30174/InspectedLibrary/InspectedLibrary.csproj
+11
-0
src/Workspaces/CoreTestUtilities/Resources/Issue30174/ReferencedLibrary/ReferencedLibrary.csproj
...ces/Issue30174/ReferencedLibrary/ReferencedLibrary.csproj
+7
-0
src/Workspaces/CoreTestUtilities/Resources/Issue30174/ReferencedLibrary/SomeMetadataAttribute.cs
...ces/Issue30174/ReferencedLibrary/SomeMetadataAttribute.cs
+9
-0
src/Workspaces/CoreTestUtilities/Resources/Issue30174/Solution.sln
...paces/CoreTestUtilities/Resources/Issue30174/Solution.sln
+48
-0
src/Workspaces/CoreTestUtilities/TestFiles/Resources.cs
src/Workspaces/CoreTestUtilities/TestFiles/Resources.cs
+5
-0
src/Workspaces/CoreTestUtilities/WorkspaceTestBase.cs
src/Workspaces/CoreTestUtilities/WorkspaceTestBase.cs
+1
-0
src/Workspaces/MSBuildTest/MSBuildWorkspaceTests.cs
src/Workspaces/MSBuildTest/MSBuildWorkspaceTests.cs
+1
-2
src/Workspaces/MSBuildTest/NetCoreTests.cs
src/Workspaces/MSBuildTest/NetCoreTests.cs
+54
-4
未找到文件。
src/Workspaces/CoreTestUtilities/Resources/Issue30174/InspectedLibrary/InspectedClass.cs
0 → 100644
浏览文件 @
e9bee533
using
System
;
using
System.Threading.Tasks
;
using
ReferencedLibrary
;
namespace
InspectedLibrary
{
[
SomeMetadata
]
public
class
InspectedClass
{
public
Task
DoAsync
()
{
throw
new
NotImplementedException
();
}
}
}
src/Workspaces/CoreTestUtilities/Resources/Issue30174/InspectedLibrary/InspectedLibrary.csproj
0 → 100644
浏览文件 @
e9bee533
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\ReferencedLibrary\ReferencedLibrary.csproj" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
src/Workspaces/CoreTestUtilities/Resources/Issue30174/ReferencedLibrary/ReferencedLibrary.csproj
0 → 100644
浏览文件 @
e9bee533
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
src/Workspaces/CoreTestUtilities/Resources/Issue30174/ReferencedLibrary/SomeMetadataAttribute.cs
0 → 100644
浏览文件 @
e9bee533
using
System
;
namespace
ReferencedLibrary
{
[
AttributeUsage
(
AttributeTargets
.
Class
,
Inherited
=
false
,
AllowMultiple
=
false
)]
public
sealed
class
SomeMetadataAttribute
:
Attribute
{
}
}
src/Workspaces/CoreTestUtilities/Resources/Issue30174/Solution.sln
0 → 100644
浏览文件 @
e9bee533
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReferencedLibrary", "ReferencedLibrary\ReferencedLibrary.csproj", "{A5800480-7965-4BA3-95F5-4830B831163D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InspectedLibrary", "InspectedLibrary\InspectedLibrary.csproj", "{86B44D47-6E01-4385-AFDB-C82695AFD2DA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A5800480-7965-4BA3-95F5-4830B831163D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5800480-7965-4BA3-95F5-4830B831163D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5800480-7965-4BA3-95F5-4830B831163D}.Debug|x64.ActiveCfg = Debug|Any CPU
{A5800480-7965-4BA3-95F5-4830B831163D}.Debug|x64.Build.0 = Debug|Any CPU
{A5800480-7965-4BA3-95F5-4830B831163D}.Debug|x86.ActiveCfg = Debug|Any CPU
{A5800480-7965-4BA3-95F5-4830B831163D}.Debug|x86.Build.0 = Debug|Any CPU
{A5800480-7965-4BA3-95F5-4830B831163D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5800480-7965-4BA3-95F5-4830B831163D}.Release|Any CPU.Build.0 = Release|Any CPU
{A5800480-7965-4BA3-95F5-4830B831163D}.Release|x64.ActiveCfg = Release|Any CPU
{A5800480-7965-4BA3-95F5-4830B831163D}.Release|x64.Build.0 = Release|Any CPU
{A5800480-7965-4BA3-95F5-4830B831163D}.Release|x86.ActiveCfg = Release|Any CPU
{A5800480-7965-4BA3-95F5-4830B831163D}.Release|x86.Build.0 = Release|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Debug|x64.ActiveCfg = Debug|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Debug|x64.Build.0 = Debug|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Debug|x86.ActiveCfg = Debug|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Debug|x86.Build.0 = Debug|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Release|Any CPU.Build.0 = Release|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Release|x64.ActiveCfg = Release|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Release|x64.Build.0 = Release|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Release|x86.ActiveCfg = Release|Any CPU
{86B44D47-6E01-4385-AFDB-C82695AFD2DA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
src/Workspaces/CoreTestUtilities/TestFiles/Resources.cs
浏览文件 @
e9bee533
...
...
@@ -87,6 +87,7 @@ public static class SolutionFiles
public
static
string
DuplicatedGuidsBecomeCircularReferential
=>
GetText
(
"SolutionFiles.DuplicatedGuidsBecomeCircularReferential.sln"
);
public
static
string
EmptyLineBetweenProjectBlock
=>
GetText
(
"SolutionFiles.EmptyLineBetweenProjectBlock.sln"
);
public
static
string
Issue29122_Solution
=>
GetText
(
"Issue29122.TestVB2.sln"
);
public
static
string
Issue30174_Solution
=>
GetText
(
"Issue30174.Solution.sln"
);
public
static
string
InvalidProjectPath
=>
GetText
(
"SolutionFiles.InvalidProjectPath.sln"
);
public
static
string
MissingEndProject1
=>
GetText
(
"SolutionFiles.MissingEndProject1.sln"
);
public
static
string
MissingEndProject2
=>
GetText
(
"SolutionFiles.MissingEndProject2.sln"
);
...
...
@@ -125,6 +126,8 @@ public static class CSharp
public
static
string
ExternAlias
=>
GetText
(
"ProjectFiles.CSharp.ExternAlias.csproj"
);
public
static
string
ExternAlias2
=>
GetText
(
"ProjectFiles.CSharp.ExternAlias2.csproj"
);
public
static
string
ForEmittedOutput
=>
GetText
(
"ProjectFiles.CSharp.ForEmittedOutput.csproj"
);
public
static
string
Issue30174_InspectedLibrary
=>
GetText
(
"Issue30174.InspectedLibrary.InspectedLibrary.csproj"
);
public
static
string
Issue30174_ReferencedLibrary
=>
GetText
(
"Issue30174.ReferencedLibrary.ReferencedLibrary.csproj"
);
public
static
string
MsbuildError
=>
GetText
(
"ProjectFiles.CSharp.MsbuildError.csproj"
);
public
static
string
MallformedAdditionalFilePath
=>
GetText
(
"ProjectFiles.CSharp.MallformedAdditionalFilePath.csproj"
);
public
static
string
NetCoreApp2_Project
=>
GetText
(
"NetCoreApp2.Project.csproj"
);
...
...
@@ -186,6 +189,8 @@ public static class CSharp
public
static
string
CSharpClass_WithConditionalAttributes
=>
GetText
(
"SourceFiles.CSharp.CSharpClass_WithConditionalAttributes.cs"
);
public
static
string
CSharpConsole
=>
GetText
(
"SourceFiles.CSharp.CSharpConsole.cs"
);
public
static
string
CSharpExternAlias
=>
GetText
(
"SourceFiles.CSharp.CSharpExternAlias.cs"
);
public
static
string
Issue30174_InspectedClass
=>
GetText
(
"Issue30174.InspectedLibrary.InspectedClass.cs"
);
public
static
string
Issue30174_SomeMetadataAttribute
=>
GetText
(
"Issue30174.ReferencedLibrary.SomeMetadataAttribute.cs"
);
public
static
string
NetCoreApp2_Program
=>
GetText
(
"NetCoreApp2.Program.cs"
);
public
static
string
NetCoreApp2AndLibrary_Class1
=>
GetText
(
"NetCoreApp2AndLibrary.Class1.cs"
);
public
static
string
NetCoreApp2AndLibrary_Program
=>
GetText
(
"NetCoreApp2AndLibrary.Program.cs"
);
...
...
src/Workspaces/CoreTestUtilities/WorkspaceTestBase.cs
浏览文件 @
e9bee533
...
...
@@ -90,6 +90,7 @@ protected void CreateCSharpFiles()
protected
FileSet
GetBaseFiles
()
{
return
new
FileSet
(
(
@"NuGet.Config"
,
Resources
.
NuGet_Config
),
(
@"Directory.Build.props"
,
Resources
.
Directory_Build_props
),
(
@"Directory.Build.targets"
,
Resources
.
Directory_Build_targets
));
}
...
...
src/Workspaces/MSBuildTest/MSBuildWorkspaceTests.cs
浏览文件 @
e9bee533
...
...
@@ -3517,11 +3517,10 @@ public async Task TestOpenProject_CommandLineArgsHaveNoErrors()
var
projectFilePath
=
GetSolutionFileName
(
@"CSharpProject\CSharpProject.csproj"
);
var
properties
=
ImmutableDictionary
<
string
,
string
>.
Empty
;
var
buildManager
=
new
ProjectBuildManager
();
buildManager
.
Start
();
var
projectFile
=
await
loader
.
LoadProjectFileAsync
(
projectFilePath
,
properties
,
buildManager
,
CancellationToken
.
None
);
var
projectFile
=
await
loader
.
LoadProjectFileAsync
(
projectFilePath
,
buildManager
,
CancellationToken
.
None
);
var
projectFileInfo
=
(
await
projectFile
.
GetProjectFileInfosAsync
(
CancellationToken
.
None
)).
Single
();
buildManager
.
Stop
();
...
...
src/Workspaces/MSBuildTest/NetCoreTests.cs
浏览文件 @
e9bee533
...
...
@@ -7,6 +7,7 @@
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Microsoft.CodeAnalysis.UnitTests
;
using
Microsoft.CodeAnalysis.UnitTests.TestFiles
;
using
Roslyn.Test.Utilities
;
using
Roslyn.Utilities
;
using
Xunit
;
...
...
@@ -22,7 +23,7 @@ public NetCoreTests()
_nugetCacheDir
=
SolutionDirectory
.
CreateDirectory
(
".packages"
);
}
private
void
DotNetRestore
(
string
solutionOrProjectFileName
)
private
void
RunDotNet
(
string
arguments
)
{
Assert
.
NotNull
(
DotNetCoreSdk
.
ExePath
);
...
...
@@ -32,12 +33,29 @@ private void DotNetRestore(string solutionOrProjectFileName)
};
var
restoreResult
=
ProcessUtilities
.
Run
(
fileName
:
DotNetCoreSdk
.
ExePath
,
arguments
:
$@"msbuild ""
{
solutionOrProjectFileName
}
"" /t:restore /bl:
{
Path
.
Combine
(
SolutionDirectory
.
Path
,
"restore.binlog"
)}
"
,
DotNetCoreSdk
.
ExePath
,
arguments
,
workingDirectory
:
SolutionDirectory
.
Path
,
additionalEnvironmentVars
:
environmentVariables
);
Assert
.
True
(
restoreResult
.
ExitCode
==
0
,
$"Restore failed with exit code
{
restoreResult
.
ExitCode
}
:
{
restoreResult
.
Output
}
"
);
Assert
.
True
(
restoreResult
.
ExitCode
==
0
,
$"
{
DotNetCoreSdk
.
ExePath
}
failed with exit code
{
restoreResult
.
ExitCode
}
:
{
restoreResult
.
Output
}
"
);
}
private
void
DotNetRestore
(
string
solutionOrProjectFileName
)
{
var
arguments
=
$@"msbuild ""
{
solutionOrProjectFileName
}
"" /t:restore /bl:
{
Path
.
Combine
(
SolutionDirectory
.
Path
,
"restore.binlog"
)}
"
;
RunDotNet
(
arguments
);
}
private
void
DotNetBuild
(
string
solutionOrProjectFileName
,
string
configuration
=
null
)
{
var
arguments
=
$@"msbuild ""
{
solutionOrProjectFileName
}
"" /bl:
{
Path
.
Combine
(
SolutionDirectory
.
Path
,
"restore.binlog"
)}
"
;
if
(
configuration
!=
null
)
{
arguments
+=
$" /p:Configuration=
{
configuration
}
"
;
}
RunDotNet
(
arguments
);
}
[
ConditionalFact
(
typeof
(
VisualStudioMSBuildInstalled
),
typeof
(
DotNetCoreSdk
.
IsAvailable
))]
...
...
@@ -347,5 +365,37 @@ public async Task TestOpenSolution_NetCoreMultiTFMWithProjectReferenceToFSharp()
}
}
}
[
ConditionalFact
(
typeof
(
VisualStudioMSBuildInstalled
),
typeof
(
DotNetCoreSdk
.
IsAvailable
))]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
MSBuildWorkspace
)]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
NetCore
)]
public
async
Task
TestOpenSolution_ReferenceConfigurationSpecificMetadata
()
{
var
files
=
GetBaseFiles
()
.
WithFile
(
@"Solution.sln"
,
Resources
.
SolutionFiles
.
Issue30174_Solution
)
.
WithFile
(
@"InspectedLibrary\InspectedLibrary.csproj"
,
Resources
.
ProjectFiles
.
CSharp
.
Issue30174_InspectedLibrary
)
.
WithFile
(
@"InspectedLibrary\InspectedClass.cs"
,
Resources
.
SourceFiles
.
CSharp
.
Issue30174_InspectedClass
)
.
WithFile
(
@"ReferencedLibrary\ReferencedLibrary.csproj"
,
Resources
.
ProjectFiles
.
CSharp
.
Issue30174_ReferencedLibrary
)
.
WithFile
(
@"ReferencedLibrary\SomeMetadataAttribute.cs"
,
Resources
.
SourceFiles
.
CSharp
.
Issue30174_SomeMetadataAttribute
);
CreateFiles
(
files
);
DotNetRestore
(
"Solution.sln"
);
DotNetBuild
(
"Solution.sln"
,
configuration
:
"Release"
);
var
projectFilePath
=
GetSolutionFileName
(
@"InspectedLibrary\InspectedLibrary.csproj"
);
using
(
var
workspace
=
CreateMSBuildWorkspace
((
"Configuration"
,
"Release"
)))
{
workspace
.
LoadMetadataForReferencedProjects
=
true
;
var
project
=
await
workspace
.
OpenProjectAsync
(
projectFilePath
);
Assert
.
Empty
(
project
.
ProjectReferences
);
Assert
.
Empty
(
workspace
.
Diagnostics
);
var
compilation
=
await
project
.
GetCompilationAsync
();
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录