|
1 | 1 | <Project Sdk="Microsoft.NET.Sdk"> |
2 | 2 |
|
| 3 | + <PropertyGroup> |
| 4 | + <_Roslyn44AnalyzerDir>$(MSBuildProjectDirectory)/bin/roslyn4.4/</_Roslyn44AnalyzerDir> |
| 5 | + </PropertyGroup> |
| 6 | + |
| 7 | + <PropertyGroup Condition="'$(RoslynVersion)' == '4.4'"> |
| 8 | + <BaseOutputPath>$(_Roslyn44AnalyzerDir)</BaseOutputPath> |
| 9 | + <BaseIntermediateOutputPath>$(MSBuildProjectDirectory)/obj/roslyn4.4/</BaseIntermediateOutputPath> |
| 10 | + <DefaultItemExcludes>$(DefaultItemExcludes);$(MSBuildProjectDirectory)/obj/**</DefaultItemExcludes> |
| 11 | + <DefineConstants>$(DefineConstants);ROSLYN4_4</DefineConstants> |
| 12 | + </PropertyGroup> |
| 13 | + |
3 | 14 | <PropertyGroup> |
4 | 15 | <TargetFrameworks>netstandard2.1;netstandard2.0;net47</TargetFrameworks> |
5 | 16 | <DefineConstants>$(DefineConstants);DOCOPTNET_PUBLIC</DefineConstants> |
@@ -49,14 +60,23 @@ Portions Copyright (C) West Wind Technologies, 2008. |
49 | 60 | <None Include="CodeGeneration\*.cs" /> |
50 | 61 | </ItemGroup> |
51 | 62 |
|
52 | | - <ItemGroup Condition="'$(TargetFramework)' != 'net47'"> |
| 63 | + <ItemGroup Condition="'$(TargetFramework)' != 'net47' And '$(RoslynVersion)' != '4.4'"> |
53 | 64 | <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.10.0" PrivateAssets="all" /> |
| 65 | + </ItemGroup> |
| 66 | + |
| 67 | + <ItemGroup Condition="'$(TargetFramework)' != 'net47' And '$(RoslynVersion)' == '4.4'"> |
| 68 | + <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" PrivateAssets="all" /> |
| 69 | + </ItemGroup> |
| 70 | + |
| 71 | + <ItemGroup Condition="'$(TargetFramework)' != 'net47'"> |
54 | 72 | <AdditionalFiles Include="CodeGeneration\AnalyzerReleases.*.md" /> |
55 | 73 | </ItemGroup> |
56 | 74 |
|
57 | 75 | <ItemGroup> |
58 | 76 | <!-- Package the generator in the analyzer directory of the nuget package --> |
59 | 77 | <None Include="$(OutputPath)\netstandard2.0\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> |
| 78 | + <!-- Package the Roslyn 4.4 variant of the generator --> |
| 79 | + <None Include="$(_Roslyn44AnalyzerDir)$(Configuration)/netstandard2.0/$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/roslyn4.4/cs" Visible="false" /> |
60 | 80 | <!-- |
61 | 81 | Using a "PackagePath" of "build/$(TargetFramework)/%(Filename)%(Extension)" causes the |
62 | 82 | following error: |
@@ -96,4 +116,12 @@ Portions Copyright (C) West Wind Technologies, 2008. |
96 | 116 | <AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Unshipped.txt" /> |
97 | 117 | </ItemGroup> |
98 | 118 |
|
| 119 | + <Target Name="_ValidateRoslyn44AnalyzerOutput" BeforeTargets="GenerateNuspec"> |
| 120 | + <PropertyGroup> |
| 121 | + <_Roslyn44AnalyzerPath>$(_Roslyn44AnalyzerDir)$(Configuration)/netstandard2.0/$(AssemblyName).dll</_Roslyn44AnalyzerPath> |
| 122 | + </PropertyGroup> |
| 123 | + <Error Condition="!Exists('$(_Roslyn44AnalyzerPath)')" |
| 124 | + Text="Roslyn 4.4 analyzer output not found at '$(_Roslyn44AnalyzerPath)'. Build all Roslyn variants first by running: ./build.ps1 -Pack" /> |
| 125 | + </Target> |
| 126 | + |
99 | 127 | </Project> |
0 commit comments