Skip to content

Commit 4a3ae2e

Browse files
committed
Retarget the source generator at Roslyn 5.0 and refresh outdated package versions.
1 parent d72ad93 commit 4a3ae2e

13 files changed

Lines changed: 48 additions & 332 deletions

File tree

‎samples/Samples/Samples.csproj‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
11-
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="17.14.1" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.10.1" />
11+
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="18.10.1" />
1212
<PackageReference Include="xunit" Version="2.9.3" />
1313
<PackageReference Include="xunit.runner.msbuild" Version="2.9.3" Condition="'$(TargetFramework)' == 'net48'" />
14-
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="4.0.0" />
1515
<PackageReference Include="Stunts" Version="$(Version)" />
1616
</ItemGroup>
1717

‎src/Directory.Packages.props‎

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,23 @@
1010
<PackageVersion Include="ThisAssembly" Version="2.1.5" />
1111
<PackageVersion Include="NuGetizer" Version="1.5.0" />
1212
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
13-
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.2" />
1413
</ItemGroup>
1514

1615
<ItemGroup Label="Roslyn">
17-
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.14.0" />
18-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
19-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0"/>
20-
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.14.0" />
21-
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.14.0" />
22-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="3.8.0" />
16+
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="5.9.0" />
17+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.9.0" />
18+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="5.9.0"/>
19+
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="5.9.0" />
20+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="5.9.0" />
2321
<!-- Required to unify this dependency across projects. -->
2422
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
2523

2624
<!-- When running under .netframework, this dependency will be needed -->
27-
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
25+
<PackageVersion Include="System.ValueTuple" Version="4.6.2" />
2826

2927
<!-- For packaging purposes -->
30-
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0" />
31-
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
28+
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.12" />
29+
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
3230

3331
<!-- Native SQLite for tests on macOS. 3.x drops the vulnerable SQLitePCLRaw.lib.e_sqlite3 package. -->
3432
<PackageVersion Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.5" />
@@ -39,31 +37,27 @@
3937
</ItemGroup>
4038

4139
<ItemGroup Label="Tests">
42-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
43-
<PackageVersion Include="Microsoft.TestPlatform.ObjectModel" Version="17.14.1" />
44-
<PackageVersion Include="Moq" Version="4.16.1" />
40+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.10.1" />
41+
<PackageVersion Include="Microsoft.TestPlatform.ObjectModel" Version="18.10.1" />
42+
<PackageVersion Include="Moq" Version="4.21.0" />
4543
<PackageVersion Include="xunit" Version="2.9.3" />
4644
<PackageVersion Include="xunit.runner.console" Version="2.9.3" />
4745
<PackageVersion Include="xunit.runner.msbuild" Version="2.9.3" />
48-
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
49-
<PackageVersion Include="System.ComponentModel.Composition" Version="5.0.0" />
50-
51-
<PackageVersion Include="NuGet.Client" Version="4.2.0" />
52-
<PackageVersion Include="NuGet.Protocol" Version="7.9.0" />
46+
<PackageVersion Include="xunit.runner.visualstudio" Version="4.0.0" />
5347
</ItemGroup>
5448

5549
<ItemGroup Label="MSBuild">
56-
<PackageVersion Include="Microsoft.Build" Version="18.9.6" />
57-
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="17.14.28" />
58-
<PackageVersion Include="Microsoft.Build.Locator" Version="1.4.1" />
59-
<PackageVersion Include="MSBuild.StructuredLogger" Version="2.1.500" />
50+
<PackageVersion Include="Microsoft.Build" Version="18.10.1" />
51+
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="18.10.1" />
52+
<PackageVersion Include="Microsoft.Build.Locator" Version="1.11.2" />
53+
<PackageVersion Include="MSBuild.StructuredLogger" Version="2.3.246" />
6054
</ItemGroup>
6155

6256
<ItemGroup>
63-
<PackageVersion Include="TypeNameFormatter.Sources" Version="1.1.1" />
64-
<PackageVersion Include="Castle.Core" Version="4.4.1" />
65-
<PackageVersion Include="Superpower" Version="2.3.0" />
66-
<PackageVersion Include="docfx.console" Version="2.57.2" />
57+
<PackageVersion Include="TypeNameFormatter.Sources" Version="1.1.2" />
58+
<PackageVersion Include="Castle.Core" Version="5.2.1" />
59+
<PackageVersion Include="Superpower" Version="3.2.1" />
60+
<PackageVersion Include="docfx.console" Version="2.59.4" />
6761
</ItemGroup>
6862

6963
</Project>

‎src/Directory.props‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818

1919
<!-- We need this in .props so it kicks-in before all the common.props defaulting -->
2020
<PropertyGroup Label="Stunts.StaticProxy" Condition="$(MSBuildProjectName) == 'Stunts.StaticProxy'">
21-
<RoslynVersion>4.14.0</RoslynVersion>
21+
<!-- Compile against the 5.0 public API. tools\5.0 is the 5.x band, so the
22+
same generator loads on 5.0 through the latest 5.x compiler. -->
23+
<RoslynVersion>5.0.0</RoslynVersion>
24+
<RoslynToolsVersion>5.0</RoslynToolsVersion>
2225
<BaseIntermediateOutputPath>obj\$(RoslynVersion)\</BaseIntermediateOutputPath>
2326
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
2427
<OutputPath>bin\$(RoslynVersion)\$(Configuration)</OutputPath>

‎src/Stunts.CodeAnalysis/Stunts.CodeAnalysis.csproj‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
<ItemGroup>
1616
<PackageReference Include="Superpower" PrivateAssets="all" />
17-
<PackageReference Include="Microsoft.CodeAnalysis.Common" Pack="false" />
17+
<!-- 5.0 is the floor of the 5.x compiler line. The generator is packed once under tools\5.0. -->
18+
<PackageReference Include="Microsoft.CodeAnalysis.Common" VersionOverride="5.0.0" Pack="false" />
1819
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" PrivateAssets="all" />
1920
</ItemGroup>
2021

‎src/Stunts.IntegrationTests/Stunts.IntegrationTests.csproj‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,26 @@
2525

2626
<ItemGroup Label="Targets">
2727
<PackageReference Include="Microsoft.ApplicationInsights" />
28-
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.17.0" />
28+
<PackageVersion Include="Microsoft.ApplicationInsights" Version="3.1.2" />
2929
</ItemGroup>
3030

3131
<ItemGroup Label="net10 Targets" Condition="'$(TargetFramework)' == 'net10.0'">
3232
<PackageReference Include="Microsoft.EntityFrameworkCore" />
33-
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="5.0.5" />
33+
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.12" />
3434

3535
<PackageReference Include="Microsoft.AspNetCore.Mvc" />
3636
<PackageVersion Include="Microsoft.AspNetCore.Mvc" Version="2.3.13" />
3737
</ItemGroup>
3838

3939
<ItemGroup Label="net48 Targets" Condition="'$(TargetFramework)' == 'net48'">
4040
<PackageReference Include="EntityFramework" />
41-
<PackageVersion Include="EntityFramework" Version="6.4.4" />
41+
<PackageVersion Include="EntityFramework" Version="6.5.2" />
4242

4343
<PackageReference Include="Microsoft.AspNet.Mvc" />
44-
<PackageVersion Include="Microsoft.AspNet.Mvc" Version="5.2.7" />
44+
<PackageVersion Include="Microsoft.AspNet.Mvc" Version="5.3.0" />
4545

4646
<PackageReference Include="Microsoft.AspNet.WebApi" />
47-
<PackageVersion Include="Microsoft.AspNet.WebApi" Version="5.2.7" />
47+
<PackageVersion Include="Microsoft.AspNet.WebApi" Version="5.3.0" />
4848
</ItemGroup>
4949

5050
<ItemGroup>

‎src/Stunts.Package/Stunts.Package.msbuildproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.Build.NoTargets/3.7.134" DefaultTargets="Pack">
1+
<Project Sdk="Microsoft.Build.NoTargets/3.7.134" DefaultTargets="Pack">
22
<PropertyGroup>
33
<TargetFramework>netstandard2.0</TargetFramework>
44
<!-- NoTargets 3.7 excludes these projects from generated solutions. This one is the package project. -->

‎src/Stunts.Package/Stunts.targets‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
Condition="'$(EnableCompileTimeStunts)' == 'true' AND '$(SkipCompilerExecution)' != 'true' AND '$(DesignTimeBuild)' != 'true'">
3131

3232
<PropertyGroup>
33-
<!-- One generator, built against the public Roslyn 4.14 API. The host
34-
compiler supplies Microsoft.CodeAnalysis. -->
35-
<StuntsAnalyzerDir>$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory)..\..\tools\4.14.0))</StuntsAnalyzerDir>
33+
<!-- One generator, built against the public Roslyn 5.0 API so it loads
34+
on any 5.x compiler. The host supplies Microsoft.CodeAnalysis. -->
35+
<StuntsAnalyzerDir>$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory)..\..\tools\5.0))</StuntsAnalyzerDir>
3636
</PropertyGroup>
3737

3838
<Error Condition="!Exists('$(StuntsAnalyzerDir)\Stunts.StaticProxy.dll')" Code="ST010"
39-
Text="Stunts.StaticProxy was not found under tools\4.14.0. Install the Stunts.DynamicProxy package to use run-time stunts." />
39+
Text="Stunts.StaticProxy was not found under tools\5.0. Install the Stunts.DynamicProxy package to use run-time stunts." />
4040

4141
<ItemGroup>
4242
<Analyzer Include="$(StuntsAnalyzerDir)\Stunts.StaticProxy.dll" NuGetPackageId="Stunts" NuGetPackageVersion="$(StuntsVersion)" />

‎src/Stunts.StaticProxy/Stunts.StaticProxy.csproj‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<IsPackable>true</IsPackable>
6-
<RoslynVersion>4.14.0</RoslynVersion>
76
<!-- ISourceGenerator is obsolete in Roslyn 4.14 (RS1042). Extended analyzer rules also ban
87
that API and the assembly probing in DependencyResolver (RS1035). Incremental generators
98
are a separate change, so RS1036 stays suppressed until then. -->

‎src/Stunts.StaticProxy/Stunts.StaticProxy.targets‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
<!-- When packaged as part of Stunts.Package, we get this property as false so we pack differently as a tool -->
1111
<PropertyGroup Condition="'$(IsPackable)' != 'true'">
12-
<PackFolder>tools\$(RoslynVersion)</PackFolder>
12+
<RoslynToolsVersion Condition="'$(RoslynToolsVersion)' == ''">5.0</RoslynToolsVersion>
13+
<PackFolder>tools\$(RoslynToolsVersion)</PackFolder>
1314
<DisableTransitiveProjectReferences>true</DisableTransitiveProjectReferences>
1415
<DisableTransitiveFrameworkReferences>true</DisableTransitiveFrameworkReferences>
1516
</PropertyGroup>
@@ -41,7 +42,7 @@
4142
and '%(Filename)' != 'Microsoft.CodeAnalysis'
4243
and '%(Filename)' != 'Microsoft.CodeAnalysis.CSharp'
4344
and '%(Filename)' != 'Microsoft.CodeAnalysis.VisualBasic'" />
44-
<PackageFile Include="@(AnalyzerFile -> '%(FullPath)')" PackagePath="tools\$(RoslynVersion)\%(Filename)%(Extension)" />
45+
<PackageFile Include="@(AnalyzerFile -> '%(FullPath)')" PackagePath="tools\$(RoslynToolsVersion)\%(Filename)%(Extension)" />
4546
</ItemGroup>
4647
</Target>
4748

‎src/Stunts.UnitTests/Stunts.UnitTests.csproj‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
<RootNamespace>Stunts.UnitTests</RootNamespace>
1212
<!-- Used in WriteCscCommandLineArgs target -->
1313
<ProvideCommandLineArgs>true</ProvideCommandLineArgs>
14+
<!-- Tests load MSBuild from the SDK via Microsoft.Build.Locator and delete the
15+
NuGet copies afterward. Locator 1.11+ errors if those assemblies are copied. -->
16+
<DisableMSBuildAssemblyCopyCheck>true</DisableMSBuildAssemblyCopyCheck>
17+
<!-- Microsoft.Build 18.10 targets net11.0 and net472. net10.0 restores the net472 assets. -->
18+
<NoWarn>$(NoWarn);NU1701</NoWarn>
19+
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
1420
</PropertyGroup>
1521

1622
<ItemGroup>

0 commit comments

Comments
 (0)