Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static void Defaults()
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

</Project>
Expand All @@ -93,8 +93,8 @@ public static void Defaults()
result.CompilationOptions.NullableContextOptions.ShouldBe(NullableContextOptions.Disable);
result.AssemblyName.ShouldBe(Path.GetFileNameWithoutExtension(CsprojFileName));
result.CompilationOptions.AllowUnsafe.ShouldBeFalse();
result.ParseOptions.LanguageVersion.ShouldBe(LanguageVersion.CSharp10); // Due to net6.0
result.CompilationOptions.WarningLevel.ShouldBe(6); // Due to net6.0
result.ParseOptions.LanguageVersion.ShouldBe(LanguageVersion.CSharp13); // Due to net9.0
result.CompilationOptions.WarningLevel.ShouldBe(9); // Due to net9.0
result.GeneratedSources.ShouldBeEmpty();
}

Expand All @@ -105,11 +105,11 @@ public static void ParsesTargetFramework()
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

</Project>
""").TargetFramework.ShouldBe("net6.0");
""").TargetFramework.ShouldBe("net9.0");
}

[Test]
Expand All @@ -119,7 +119,7 @@ public static void ParsesOutputType([Values("Library", "Exe", "WinExe")] string
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<OutputType>{outputType}</OutputType>
</PropertyGroup>

Expand All @@ -139,7 +139,7 @@ public static void ParsesNullable([Values("enable", "disable", "annotations", "w
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>{nullable}</Nullable>
</PropertyGroup>

Expand All @@ -160,7 +160,7 @@ public static void ParsesAssemblyName()
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AssemblyName>Xyz</AssemblyName>
</PropertyGroup>

Expand All @@ -175,7 +175,7 @@ public static void ParsesAllowUnsafeBlocks([Values("true", "false")] string allo
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AllowUnsafeBlocks>{allowUnsafeBlocks}</AllowUnsafeBlocks>
</PropertyGroup>

Expand All @@ -200,7 +200,7 @@ public static void ParsesImplicitUsings([Values("true", "enable", "false", "disa
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>{implicitUsings}</ImplicitUsings>
</PropertyGroup>

Expand Down
6 changes: 5 additions & 1 deletion tools/ExampleTester/ExampleTester.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@

<ItemGroup>
<PackageReference Include="Basic.Reference.Assemblies.Net60" Version="1.8.10" />
<PackageReference Include="Basic.Reference.Assemblies.Net70" Version="1.8.10" />
<PackageReference Include="Basic.Reference.Assemblies.Net80" Version="1.8.10" />
<PackageReference Include="Basic.Reference.Assemblies.Net90" Version="1.8.10" />
<PackageReference Include="Basic.Reference.Assemblies.Net100" Version="1.8.10" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="5.6.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="5.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.8.1" />
<PackageReference Include="NUnit" Version="4.6.1" />
<PackageReference Include="NUnit3TestAdapter" Version="6.2.0" />
<PackageReference Include="System.CommandLine" Version="2.0.10" />
<PackageReference Include="System.CommandLine" Version="2.0.11" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 13 additions & 2 deletions tools/ExampleTester/FastCsprojCompilationParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,23 @@ private sealed record TargetFrameworkInfo(
LanguageVersion DefaultLanguageVersion,
int DefaultWarningLevel);


// When we add new rows here, we need to add the corresponding NuGet package to ExampleTester.csproj. These packages provide the information used
// for the reference assemblies.
private static readonly FrozenDictionary<string, TargetFrameworkInfo> SupportedTargetFrameworks = new KeyValuePair<string, TargetFrameworkInfo>[]
{
new("net6.0", new(Basic.Reference.Assemblies.Net60.References.All, LanguageVersion.CSharp10, DefaultWarningLevel: 6)),
new("net7.0", new(Basic.Reference.Assemblies.Net70.References.All, LanguageVersion.CSharp11, DefaultWarningLevel: 7)),
new("net8.0", new(Basic.Reference.Assemblies.Net80.References.All, LanguageVersion.CSharp12, DefaultWarningLevel: 8)),
new("net9.0", new(Basic.Reference.Assemblies.Net90.References.All, LanguageVersion.CSharp13, DefaultWarningLevel: 9)),
new("net10.0", new(Basic.Reference.Assemblies.Net100.References.All, LanguageVersion.CSharp14, DefaultWarningLevel: 10)),
}.ToFrozenDictionary(StringComparer.OrdinalIgnoreCase);

// When we add new versions, this list changes. You'll need to change the current release from ".NET9_0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// When we add new versions, this list changes. You'll need to change the current release from ".NET9_0",
// When we add new versions, this list changes. You'll need to change the current release from "NET9_0",

// and add necessary "NET?_0_OR_GREATER" symbols.
private static readonly CSharpParseOptions DefaultParseOptions = new(preprocessorSymbols: [
"TRACE", "RELEASE", "NET", "NET6_0", "NETCOREAPP", "NET5_0_OR_GREATER", "NET6_0_OR_GREATER",
"TRACE", "RELEASE", "NET", "NET9_0", "NETCOREAPP", "NET5_0_OR_GREATER", "NET6_0_OR_GREATER",
"NET7_0_OR_GREATER","NET8_0_OR_GREATER","NET9_0_OR_GREATER",
"NETCOREAPP1_0_OR_GREATER", "NETCOREAPP1_1_OR_GREATER", "NETCOREAPP2_0_OR_GREATER",
"NETCOREAPP2_1_OR_GREATER", "NETCOREAPP2_2_OR_GREATER", "NETCOREAPP3_0_OR_GREATER",
"NETCOREAPP3_1_OR_GREATER"]);
Expand All @@ -58,7 +68,8 @@ private sealed record TargetFrameworkInfo(
new("NU1605", ReportDiagnostic.Error),
new("CS1702", ReportDiagnostic.Suppress),
new("CS1701", ReportDiagnostic.Suppress),
new("CS8002", ReportDiagnostic.Suppress)]);
new("CS8002", ReportDiagnostic.Suppress),
new("SYSLIB0011", ReportDiagnostic.Error)]);

public static CsprojParseResult ParseCsproj(XDocument csprojDocument, string filePath)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.8.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="XMLUnit.Core" Version="2.11.1" />
<PackageReference Include="XMLUnit.Core" Version="2.11.2" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
6 changes: 3 additions & 3 deletions tools/MarkdownConverter/MarkdownConverter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<ItemGroup>
<PackageReference Include="csharp2colorized" Version="1.0.3" />
<PackageReference Include="DocumentFormat.OpenXml" Version="3.5.1" />
<PackageReference Include="FSharp.Core" Version="10.1.201" />
<PackageReference Include="FSharp.Formatting" Version="22.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="5.3.0" />
<PackageReference Include="FSharp.Core" Version="11.0.100" />
<PackageReference Include="FSharp.Formatting" Version="22.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="5.6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tools/StandardAnchorTags/StandardAnchorTags.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.CommandLine" Version="2.0.10" />
<PackageReference Include="System.CommandLine" Version="2.0.11" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tools/Utilities/Utilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Octokit" Version="14.0.0" />
<PackageReference Include="System.Text.Json" Version="10.0.10" />
<PackageReference Include="System.Text.Json" Version="10.0.11" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AssemblyName>$example-name</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>annotations</Nullable>
<LangVersion>12</LangVersion>
</PropertyGroup>

</Project>
3 changes: 1 addition & 2 deletions tools/example-templates/code-in-class-lib/Project.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AssemblyName>$example-name</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>annotations</Nullable>
<LangVersion>12</LangVersion>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>annotations</Nullable>
<AssemblyName>$example-name</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>12</LangVersion>
</PropertyGroup>

</Project>
3 changes: 1 addition & 2 deletions tools/example-templates/code-in-main/Project.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>annotations</Nullable>
<AssemblyName>$example-name</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>12</LangVersion>
</PropertyGroup>

</Project>
3 changes: 1 addition & 2 deletions tools/example-templates/code-in-partial-class/Project.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AssemblyName>$example-name</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>annotations</Nullable>
<LangVersion>12</LangVersion>
</PropertyGroup>

</Project>
3 changes: 1 addition & 2 deletions tools/example-templates/extern-lib/ExampleProject.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<EnableDefaultItems>false</EnableDefaultItems>
<NoWarn>CS0169</NoWarn>
<Nullable>annotations</Nullable>
<LangVersion>9</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions tools/example-templates/extern-lib/ExternN2.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<EnableDefaultItems>false</EnableDefaultItems>
<Nullable>annotations</Nullable>
<LangVersion>9</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions tools/example-templates/extern-lib/ExternR1.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<EnableDefaultItems>false</EnableDefaultItems>
<Nullable>annotations</Nullable>
<LangVersion>9</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions tools/example-templates/extern-lib/ExternX.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<EnableDefaultItems>false</EnableDefaultItems>
<Nullable>annotations</Nullable>
<LangVersion>9</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions tools/example-templates/extern-lib/ExternY.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<EnableDefaultItems>false</EnableDefaultItems>
<Nullable>annotations</Nullable>
<LangVersion>9</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>12</LangVersion>
<AssemblyName>$example-name</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>annotations</Nullable>
Expand Down
3 changes: 1 addition & 2 deletions tools/example-templates/standalone-console/Project.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>12</LangVersion>
<AssemblyName>$example-name</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>annotations</Nullable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>$example-name</AssemblyName>
<LangVersion>12</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>annotations</Nullable>
</PropertyGroup>
Expand Down
3 changes: 1 addition & 2 deletions tools/example-templates/standalone-lib/Project.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AssemblyName>$example-name</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>annotations</Nullable>
<LangVersion>12</LangVersion>
</PropertyGroup>

</Project>
Loading