Skip to content

Commit e3ec532

Browse files
Bart KoelmanBart Koelman
authored andcommitted
Applied changes from .NET Compiler Platform SDK 2.0
his adds support for VS 2017.
1 parent a868ea0 commit e3ec532

File tree

7 files changed

+48
-36
lines changed

7 files changed

+48
-36
lines changed

src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer.Test/CSharpGuidelinesAnalyzer.Test.csproj

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
44
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5+
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
6+
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
7+
<PlatformTarget>AnyCPU</PlatformTarget>
78
<ProductVersion>8.0.30703</ProductVersion>
89
<SchemaVersion>2.0</SchemaVersion>
910
<ProjectGuid>{E3AFF0DD-B4CB-4054-BBB1-1F240B5803DC}</ProjectGuid>
1011
<OutputType>Library</OutputType>
1112
<AppDesignerFolder>Properties</AppDesignerFolder>
1213
<RootNamespace>CSharpGuidelinesAnalyzer.Test</RootNamespace>
1314
<AssemblyName>CSharpGuidelinesAnalyzer.Test</AssemblyName>
14-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
15+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
1516
<FileAlignment>512</FileAlignment>
1617
<TargetFrameworkProfile />
1718
</PropertyGroup>
@@ -21,7 +22,7 @@
2122
<StartArguments>$(AssemblyName).dll -noshadow -wait</StartArguments>
2223
<StartWorkingDirectory>$(OutDir)</StartWorkingDirectory>
2324
</PropertyGroup>
24-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
2526
<DebugSymbols>true</DebugSymbols>
2627
<DebugType>full</DebugType>
2728
<Optimize>false</Optimize>
@@ -34,7 +35,7 @@
3435
<CodeAnalysisRuleSet>..\..\CodeAnalysis.ruleset</CodeAnalysisRuleSet>
3536
<RunCodeAnalysis>true</RunCodeAnalysis>
3637
</PropertyGroup>
37-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
38+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
3839
<DebugType>pdbonly</DebugType>
3940
<Optimize>true</Optimize>
4041
<OutputPath>bin\Release\</OutputPath>
@@ -221,11 +222,4 @@
221222
</PropertyGroup>
222223
<Error Condition="!Exists('..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
223224
</Target>
224-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
225-
Other similar extension points exist, see Microsoft.Common.targets.
226-
<Target Name="BeforeBuild">
227-
</Target>
228-
<Target Name="AfterBuild">
229-
</Target>
230-
-->
231225
</Project>

src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer.Vsix/CSharpGuidelinesAnalyzer.Vsix.csproj

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
</PropertyGroup>
77
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
88
<PropertyGroup>
9-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
10-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9+
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
10+
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
11+
<PlatformTarget>AnyCPU</PlatformTarget>
1112
<SchemaVersion>2.0</SchemaVersion>
1213
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
1314
<ProjectGuid>{CBD344C6-15E1-4337-AC0A-49E72D7B31C2}</ProjectGuid>
1415
<OutputType>Library</OutputType>
1516
<AppDesignerFolder>Properties</AppDesignerFolder>
1617
<RootNamespace>CSharpGuidelinesAnalyzer</RootNamespace>
1718
<AssemblyName>CSharpGuidelinesAnalyzer</AssemblyName>
18-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
19+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
1920
<GeneratePkgDefFile>false</GeneratePkgDefFile>
2021
<IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
2122
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
@@ -28,7 +29,7 @@
2829
<!-- This property disables extension deployment for command line builds; required for AppVeyor -->
2930
<DeployExtension>False</DeployExtension>
3031
</PropertyGroup>
31-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
32+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
3233
<DebugSymbols>true</DebugSymbols>
3334
<DebugType>full</DebugType>
3435
<Optimize>false</Optimize>
@@ -38,7 +39,7 @@
3839
<WarningLevel>4</WarningLevel>
3940
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
4041
</PropertyGroup>
41-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
4243
<DebugType>pdbonly</DebugType>
4344
<Optimize>true</Optimize>
4445
<OutputPath>bin\Release\</OutputPath>
@@ -95,11 +96,4 @@
9596
<Message Text="VsixSourceItem collection now contains: @(VsixSourceItem)" Importance="High" />
9697
-->
9798
</Target>
98-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
99-
Other similar extension points exist, see Microsoft.Common.targets.
100-
<Target Name="BeforeBuild">
101-
</Target>
102-
<Target Name="AfterBuild">
103-
</Target>
104-
-->
10599
</Project>

src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer.Vsix/source.extension.vsixmanifest

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@
1717
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="CSharpGuidelinesAnalyzer" Path="|CSharpGuidelinesAnalyzer|" />
1818
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="CSharpGuidelinesAnalyzer" Path="|CSharpGuidelinesAnalyzer|" />
1919
</Assets>
20+
<Prerequisites>
21+
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,16.0)" DisplayName="Visual Studio core editor" />
22+
<Prerequisite Id="Microsoft.VisualStudio.Component.Roslyn.LanguageServices" Version="[15.0,16.0)" DisplayName="Roslyn Language Services" />
23+
</Prerequisites>
2024
</PackageManifest>

src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer.csproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
55
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
6-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
7+
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
8+
<PlatformTarget>AnyCPU</PlatformTarget>
89
<ProjectGuid>{560612BD-75DC-40B3-A070-A913B925B60F}</ProjectGuid>
910
<OutputType>Library</OutputType>
1011
<AppDesignerFolder>Properties</AppDesignerFolder>
@@ -14,7 +15,7 @@
1415
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
1516
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1617
</PropertyGroup>
17-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
1819
<DebugSymbols>true</DebugSymbols>
1920
<DebugType>full</DebugType>
2021
<Optimize>false</Optimize>
@@ -26,7 +27,7 @@
2627
<CodeAnalysisRuleSet>..\..\CodeAnalysis.ruleset</CodeAnalysisRuleSet>
2728
<RunCodeAnalysis>true</RunCodeAnalysis>
2829
</PropertyGroup>
29-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
3031
<DebugType>pdbonly</DebugType>
3132
<Optimize>true</Optimize>
3233
<OutputPath>bin\Release\</OutputPath>
@@ -175,7 +176,7 @@
175176
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
176177
</None>
177178
</ItemGroup>
178-
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\v4.6\Microsoft.Portable.CSharp.targets" />
179+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
179180
<Target Name="GetSemanticVersionFromOutputAssembly">
180181
<PropertyGroup>
181182
<In>$([System.IO.File]::ReadAllText('$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cs'))</In>

src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer.nuspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<frameworkAssemblies>
1818
<frameworkAssembly assemblyName="System" targetFramework="" />
1919
</frameworkAssemblies>
20+
<developmentDependency>true</developmentDependency>
2021
</metadata>
2122
<!-- The convention for analyzers is to put language agnostic dlls in analyzers\dotnet and language specific analyzers in either analyzers\dotnet\cs or analyzers\dotnet\vb -->
2223
<files>

src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer/tools/install.ps1

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
param($installPath, $toolsPath, $package, $project)
22

3-
$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers" ) * -Resolve
3+
if($project.Object.SupportsPackageDependencyResolution)
4+
{
5+
if($project.Object.SupportsPackageDependencyResolution())
6+
{
7+
# Do not install analyzers via install.ps1, instead let the project system handle it.
8+
return
9+
}
10+
}
11+
12+
$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers") * -Resolve
413

514
foreach($analyzersPath in $analyzersPaths)
615
{
7-
# Install the language agnostic analyzers.
816
if (Test-Path $analyzersPath)
917
{
10-
foreach ($analyzerFilePath in Get-ChildItem $analyzersPath -Filter *.dll)
18+
# Install the language agnostic analyzers.
19+
foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude *.resources.dll)
1120
{
1221
if($project.Object.AnalyzerReferences)
1322
{
@@ -38,7 +47,7 @@ foreach($analyzersPath in $analyzersPaths)
3847
$languageAnalyzersPath = join-path $analyzersPath $languageFolder
3948
if (Test-Path $languageAnalyzersPath)
4049
{
41-
foreach ($analyzerFilePath in Get-ChildItem $languageAnalyzersPath -Filter *.dll)
50+
foreach ($analyzerFilePath in Get-ChildItem -Path "$languageAnalyzersPath\*.dll" -Exclude *.resources.dll)
4251
{
4352
if($project.Object.AnalyzerReferences)
4453
{

src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer/tools/uninstall.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
param($installPath, $toolsPath, $package, $project)
22

3-
$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers" ) * -Resolve
3+
if($project.Object.SupportsPackageDependencyResolution)
4+
{
5+
if($project.Object.SupportsPackageDependencyResolution())
6+
{
7+
# Do not uninstall analyzers via uninstall.ps1, instead let the project system handle it.
8+
return
9+
}
10+
}
11+
12+
$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers") * -Resolve
413

514
foreach($analyzersPath in $analyzersPaths)
615
{
716
# Uninstall the language agnostic analyzers.
817
if (Test-Path $analyzersPath)
918
{
10-
foreach ($analyzerFilePath in Get-ChildItem $analyzersPath -Filter *.dll)
19+
foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude *.resources.dll)
1120
{
1221
if($project.Object.AnalyzerReferences)
1322
{
@@ -38,7 +47,7 @@ foreach($analyzersPath in $analyzersPaths)
3847
$languageAnalyzersPath = join-path $analyzersPath $languageFolder
3948
if (Test-Path $languageAnalyzersPath)
4049
{
41-
foreach ($analyzerFilePath in Get-ChildItem $languageAnalyzersPath -Filter *.dll)
50+
foreach ($analyzerFilePath in Get-ChildItem -Path "$languageAnalyzersPath\*.dll" -Exclude *.resources.dll)
4251
{
4352
if($project.Object.AnalyzerReferences)
4453
{

0 commit comments

Comments
 (0)