Skip to content

Commit 02f79a2

Browse files
committed
add partial support for net7.0
1 parent e0de9d4 commit 02f79a2

File tree

6 files changed

+38
-3
lines changed

6 files changed

+38
-3
lines changed

src/Sdk.net7.0-preview.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ SPDX-License-Identifier: MIT
66
<PropertyGroup Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '7.0.0'))">
77
<TargetFrameworks>net7.0;$(TargetFrameworks)</TargetFrameworks>
88
<EnablePreviewFeatures Condition="$(TargetFramework.StartsWith('net7'))">true</EnablePreviewFeatures>
9+
<RunningOnNet7PreviewSdk Condition="$(NETCoreSdkVersion.Contains('preview'))">true</RunningOnNet7PreviewSdk>
910
</PropertyGroup>
1011
</Project>

src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi.Core.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ SPDX-License-Identifier: MIT
1111
<PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion>
1212
</PropertyGroup>
1313

14+
<Import Project="..\Sdk.net7.0-preview.props" />
15+
1416
<PropertyGroup Condition=" '$(Configuration)' == 'Release' " Label="Required properties to generate API list">
1517
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1618
</PropertyGroup>
@@ -26,7 +28,11 @@ SPDX-License-Identifier: MIT
2628

2729
<ItemGroup>
2830
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="5.0.1" Condition="$(TargetFramework.StartsWith('net5.'))" />
29-
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="6.0.0" Condition="$(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('netcoreapp'))" />
31+
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="6.0.0" Condition="$(TargetFramework.StartsWith('net7.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('netcoreapp'))" />
32+
<!--
33+
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="6.0.0" Condition="$(TargetFramework.StartsWith('netcoreapp'))" />
34+
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="7.0.0" Condition="$(TargetFramework.StartsWith('net7.')) Or $(TargetFramework.StartsWith('net6.'))" />
35+
-->
3036
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
3137
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
3238

tests/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi.Core.Tests.csproj

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,20 @@ SPDX-License-Identifier: MIT
99
<NoWarn>CS2002;$(NoWarn)</NoWarn>
1010
</PropertyGroup>
1111

12+
<Import Project="..\..\src\Sdk.net7.0-preview.props" />
13+
14+
<PropertyGroup>
15+
<DefineConstants Condition="'$(RunningOnNet7PreviewSdk)' == 'true'">$(DefineConstants);SDK_NET7_PREVIEW</DefineConstants>
16+
</PropertyGroup>
17+
1218
<ItemGroup>
1319
<Compile Include="..\Common\**\*.cs" />
1420
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
1521
</ItemGroup>
1622

1723
<Target Name="WriteTestAssemblyInfo" BeforeTargets="BeforeBuild">
24+
<Warning Condition="'$(RunningOnNet7PreviewSdk)' == 'true'" Text="running on .NET 7 preview SDK" />
25+
1826
<ItemGroup>
1927
<TestProjects Include="$(TestAssemblyRootDirectory)\LibA\LibA.csproj" />
2028
<TestProjects Include="$(TestAssemblyRootDirectory)\LibB\LibB.csproj" />
@@ -27,17 +35,21 @@ SPDX-License-Identifier: MIT
2735
<MSBuild Projects="@(TestProjects)" Targets="$(_TestProjectBuildTargets)" Properties="Configuration=Release;TargetFramework=netstandard2.1">
2836
<Output TaskParameter="TargetOutputs" ItemName="TestAssembliesNetStandard21" />
2937
</MSBuild>
30-
<MSBuild Projects="@(TestProjects)" Targets="$(_TestProjectBuildTargets)" Properties="Configuration=Release;TargetFramework=net5.0">
38+
<MSBuild Projects="@(TestProjects)" Targets="$(_TestProjectBuildTargets)" Properties="Configuration=Release;TargetFramework=net5.0" Condition="'$(RunningOnNet7PreviewSdk)' != 'true'">
3139
<Output TaskParameter="TargetOutputs" ItemName="TestAssembliesNet50" />
3240
</MSBuild>
33-
<MSBuild Projects="@(TestProjects)" Targets="$(_TestProjectBuildTargets)" Properties="Configuration=Release;TargetFramework=net6.0">
41+
<MSBuild Projects="@(TestProjects)" Targets="$(_TestProjectBuildTargets)" Properties="Configuration=Release;TargetFramework=net6.0" Condition="'$(RunningOnNet7PreviewSdk)' != 'true'">
3442
<Output TaskParameter="TargetOutputs" ItemName="TestAssembliesNet60" />
3543
</MSBuild>
44+
<MSBuild Projects="@(TestProjects)" Targets="$(_TestProjectBuildTargets)" Properties="Configuration=Release;TargetFramework=net7.0" Condition="'$(RunningOnNet7PreviewSdk)' != 'true' and $(TargetFrameworks.Contains('net7.0'))">
45+
<Output TaskParameter="TargetOutputs" ItemName="TestAssembliesNet70" />
46+
</MSBuild>
3647

3748
<ItemGroup>
3849
<TestAssemblies Include="@(TestAssembliesNetStandard21)" />
3950
<TestAssemblies Include="@(TestAssembliesNet50)" />
4051
<TestAssemblies Include="@(TestAssembliesNet60)" />
52+
<TestAssemblies Include="@(TestAssembliesNet70)" />
4153
</ItemGroup>
4254

4355
<PropertyGroup>

tests/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/AssemblyLoader.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,19 @@ public void Init()
4141
[TestCase(true, "netstandard2.1")]
4242
[TestCase(false, "netstandard2.1")]
4343
#endif
44+
#if !SDK_NET7_PREVIEW
4445
#if NET5_0_OR_GREATER
4546
[TestCase(true, "net5.0")]
4647
[TestCase(false, "net5.0")]
4748
#endif
4849
#if NET6_0_OR_GREATER
4950
[TestCase(true, "net6.0")]
5051
[TestCase(false, "net6.0")]
52+
#endif
53+
#if NET7_0_OR_GREATER
54+
[TestCase(true, "net7.0")]
55+
[TestCase(false, "net7.0")]
56+
#endif
5157
#endif
5258
public void UsingAssembly(bool loadIntoReflectionOnlyContext, string targetFrameworkMoniker)
5359
{
@@ -102,13 +108,19 @@ public void UsingAssembly(bool loadIntoReflectionOnlyContext, string targetFrame
102108
[TestCase(true, "netstandard2.1")]
103109
[TestCase(false, "netstandard2.1")]
104110
#endif
111+
#if !SDK_NET7_PREVIEW
105112
#if NET5_0_OR_GREATER
106113
[TestCase(true, "net5.0")]
107114
[TestCase(false, "net5.0")]
108115
#endif
109116
#if NET6_0_OR_GREATER
110117
[TestCase(true, "net6.0")]
111118
[TestCase(false, "net6.0")]
119+
#endif
120+
#if NET7_0_OR_GREATER
121+
[TestCase(true, "net7.0")]
122+
[TestCase(false, "net7.0")]
123+
#endif
112124
#endif
113125
public void UsingAssembly_ResolveDependency(bool loadIntoReflectionOnlyContext, string targetFrameworkMoniker)
114126
{

tests/test-assm/LibA/LibA.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
<PropertyGroup>
33
<TargetFrameworks>net6.0;net5.0;netstandard2.1</TargetFrameworks>
44
</PropertyGroup>
5+
6+
<Import Project="..\..\..\src\Sdk.net7.0-preview.props" />
57
</Project>

tests/test-assm/LibB/LibB.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<TargetFrameworks>net6.0;net5.0;netstandard2.1</TargetFrameworks>
44
</PropertyGroup>
55

6+
<Import Project="..\..\..\src\Sdk.net7.0-preview.props" />
7+
68
<ItemGroup>
79
<ProjectReference Include="..\LibA\LibA.csproj" />
810
</ItemGroup>

0 commit comments

Comments
 (0)