Skip to content

Commit 27783c6

Browse files
committed
SWEEP: Added legacy support for Visual Studio 2022, excluding net10.0, netstandard2.0, and .NET Framework from compilation. net10.0 isn't supported at all. The others cause invalid warnings in VS 2022 and excluding them from compile is the simplest way around that.
1 parent c5037a5 commit 27783c6

5 files changed

Lines changed: 19 additions & 12 deletions

File tree

TestTargetFramework.props

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@
2929
<!--<TargetFramework>net472</TargetFramework>-->
3030
<!--<TargetFramework>net48</TargetFramework>-->
3131
<!--<TargetFramework>net8.0</TargetFramework>-->
32-
<!-- Default for local development - conditional based on VS version (VS2024+ = 18.0) -->
33-
<TargetFramework Condition=" '$(VisualStudioVersion)' &gt;= '18.0' ">net10.0</TargetFramework>
34-
<TargetFramework Condition=" '$(VisualStudioVersion)' &lt; '18.0' Or '$(VisualStudioVersion)' == '' ">net8.0</TargetFramework>
32+
<!--<TargetFramework>net9.0</TargetFramework>-->
33+
<TargetFramework>net10.0</TargetFramework>
34+
35+
<!-- Downgrade when using VS 2022 due to lack of support for net10.0. Testing .NET Fraemework on VS 2022
36+
is possible, but be warned that it may produce several misleading build warnings due to lack of analyzer support for C# 14.0 features. -->
37+
<TargetFramework Condition=" '$(TargetFramework)' == 'net10.0' And '$(IsLegacyVisualStudioVersion)' == 'true' ">net8.0</TargetFramework>
3538

3639
<!-- Allow the build script to pass in the test frameworks to build for.
3740
This overrides the above TargetFramework setting.
@@ -48,7 +51,7 @@
4851

4952
<!-- CI builds - always build all test frameworks (CI installs required SDKs) -->
5053
<TargetFrameworks Condition=" '$(TestFrameworks)' == 'true' ">net10.0;net9.0;net8.0</TargetFrameworks>
51-
<TargetFrameworks Condition=" '$(TestFrameworks)' == 'true' AND $([MSBuild]::IsOsPlatform('Windows')) ">$(TargetFrameworks);net48;net472</TargetFrameworks>
54+
<TargetFrameworks Condition=" '$(TestFrameworks)' == 'true' And $([MSBuild]::IsOsPlatform('Windows')) And '$(IsLegacyVisualStudioVersion)' != 'true' ">$(TargetFrameworks);net48;net472</TargetFrameworks>
5255
<TargetFramework Condition=" '$(TargetFrameworks)' != '' "></TargetFramework>
5356
</PropertyGroup>
5457

src/Lucene.Net.Analysis.OpenNLP/Lucene.Net.Analysis.OpenNLP.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@
3333
<!-- Currently, IKVM doesn't officially support building NetFX on anything but Windows, so we skip it for contributors who may be on various platforms.
3434
We can remove the condition once that has been addressed. See: https://github.com/ikvmnet/ikvm-maven/issues/49 -->
3535
<!-- net10.0 is conditional on VS version (VS2024+ = 18.0) -->
36-
<TargetFrameworks Condition=" '$(VisualStudioVersion)' &gt;= '18.0' ">net10.0;net8.0</TargetFrameworks>
37-
<TargetFrameworks Condition=" '$(VisualStudioVersion)' &lt; '18.0' Or '$(VisualStudioVersion)' == '' ">net8.0</TargetFrameworks>
38-
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net472</TargetFrameworks>
36+
<!-- .NET Framework is conditional on VS version (VS2024+ = 18.0) due to invalid build warnings with C# 14.0 build features -->
37+
<TargetFrameworks>net10.0;net8.0</TargetFrameworks>
38+
<TargetFrameworks Condition=" '$(IsLegacyVisualStudioVersion)' == 'true' ">net8.0</TargetFrameworks>
39+
<TargetFrameworks Condition=" $([MSBuild]::IsOsPlatform('Windows')) And '$(IsLegacyVisualStudioVersion)' != 'true' ">$(TargetFrameworks);net472</TargetFrameworks>
3940

4041
<AssemblyTitle>Lucene.Net.Analysis.OpenNLP</AssemblyTitle>
4142
<PackageTags>$(PackageTags);analysis;natural;language;processing;opennlp</PackageTags>

src/Lucene.Net.Tests.Analysis.OpenNLP/Lucene.Net.Tests.Analysis.OpenNLP.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525

2626
<PropertyGroup>
2727
<!-- Allow specific target framework to flow in from TestTargetFrameworks.props -->
28+
<!-- net10.0 is conditional on VS version (VS2024+ = 18.0) -->
2829
<!--suppress MsbuildTargetFrameworkTagInspection - even though this only has one target right now, we need to use the plural version for the line below -->
2930
<TargetFrameworks Condition=" '$(TargetFramework)' == '' ">net10.0;net9.0;net8.0</TargetFrameworks>
30-
<TargetFrameworks Condition=" '$(TargetFramework)' == '' AND $([MSBuild]::IsOsPlatform('Windows')) ">$(TargetFrameworks);net48</TargetFrameworks>
31+
<TargetFrameworks Condition=" '$(TargetFramework)' == '' And '$(IsLegacyVisualStudioVersion)' == 'true' ">net9.0;net8.0</TargetFrameworks>
32+
<TargetFrameworks Condition=" '$(TargetFramework)' == '' And $([MSBuild]::IsOsPlatform('Windows')) And '$(IsLegacyVisualStudioVersion)' != 'true' ">$(TargetFrameworks);net48</TargetFrameworks>
3133

3234
<AssemblyTitle>Lucene.Net.Tests.Analysis.OpenNLP</AssemblyTitle>
3335
<RootNamespace>Lucene.Net.Analysis.OpenNlp</RootNamespace>
@@ -39,7 +41,6 @@
3941
<IsPublishable>false</IsPublishable>
4042
<IsTestProject>false</IsTestProject>
4143
<!-- For the IDE, the above doesn't work. Redirect to a supported test framework instead. -->
42-
<TargetFramework>net48</TargetFramework>
4344
<TargetFramework Condition=" '$(TargetFramework)' == 'net472' ">net48</TargetFramework>
4445
</PropertyGroup>
4546

src/dotnet/Lucene.Net.ICU/Lucene.Net.ICU.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<Import Project="$(SolutionDir).build/nuget.props" />
3131

3232
<PropertyGroup>
33-
<TargetFrameworks>net10.0;net8.0;netstandard2.0;net462</TargetFrameworks>
33+
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
3434

3535
<AssemblyTitle>Lucene.Net.ICU</AssemblyTitle>
3636
<PackageTags>$(PackageTags);icu;international;unicode</PackageTags>

src/dotnet/Lucene.Net.Tests.CodeAnalysis/Lucene.Net.Tests.CodeAnalysis.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
<Project Sdk="Microsoft.NET.Sdk">
2323

2424
<PropertyGroup>
25-
<TargetFramework>net10.0</TargetFramework>
25+
<!-- We don't really care which target framework we test with - this is just to emulate Visual Studio 2017+ all which can load netstandard1.3 analyzers -->
26+
<!-- Given that VS 2022 doesn't support net10.0 we will use net8.0 (which will outlive net9.0). We will need to adjust this when we stop testing on net8.0. -->
27+
<TargetFramework>net8.0</TargetFramework>
2628
<RootNamespace>Lucene.Net.CodeAnalysis</RootNamespace>
2729

2830
<IsPublishable>false</IsPublishable>
29-
<IsPublishable Condition=" '$(TargetFramework)' == 'net10.0' ">true</IsPublishable>
31+
<IsPublishable Condition=" '$(TargetFramework)' == 'net8.0' ">true</IsPublishable>
3032
<IsTestProject>true</IsTestProject>
3133
</PropertyGroup>
3234

0 commit comments

Comments
 (0)