Skip to content

Commit

Permalink
Update reference assemblies for .NET 8.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Hoff <phillip@orst.edu>
  • Loading branch information
philliphoff committed Dec 4, 2023
1 parent fab8e9d commit 8d9e00a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
27 changes: 25 additions & 2 deletions test/Dapr.Actors.Generators.Test/CSharpSourceGeneratorVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Testing;
using Microsoft.CodeAnalysis.Testing;
using Microsoft.CodeAnalysis.Testing.Verifiers;

/// <remarks>
Expand All @@ -27,8 +28,30 @@ public class Test : CSharpSourceGeneratorTest<TSourceGenerator, XUnitVerifier>
{
public Test()
{
// NOTE: There's no Net70 yet, so we're using Net60 for now. Hopefully it "just works".
this.ReferenceAssemblies = Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.Net.Net60;
int frameworkVersion =
#if NET6_0
6;
#elif NET7_0
7;
#elif NET8_0
8;
#endif

//
// NOTE: Ordinarily we'd use the following:
//
// this.ReferenceAssemblies = Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.Net.Net60;
//
// However, Net70 and Net80 are not yet available in the current version of the Roslyn SDK.
//

this.ReferenceAssemblies =
new ReferenceAssemblies(
$"net{frameworkVersion}.0",
new PackageIdentity(
"Microsoft.NETCore.App.Ref",
$"{frameworkVersion}.0.0"),
Path.Combine("ref", $"net{frameworkVersion}.0"));
}

protected override CompilationOptions CreateCompilationOptions()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

Expand All @@ -15,10 +13,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.7.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.XUnit" Version="1.1.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.7.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
Expand Down

0 comments on commit 8d9e00a

Please sign in to comment.