Skip to content

Commit

Permalink
remove explicit LangVersion from a few projects (#75806)
Browse files Browse the repository at this point in the history
* remove explicit LangVersion from a few projects

* feedback

* net7.0

* net7.0

Co-authored-by: kasperk81 <kasperk81 83082615+kasperk81@users.noreply.github.com>
Co-authored-by: kasperk81 <kasperk81 kasperk81 83082615+kasperk81@users.noreply.github.com>
  • Loading branch information
3 people committed Sep 29, 2022
1 parent e1a9948 commit 08d0bd9
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 19 deletions.
3 changes: 0 additions & 3 deletions src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
<PackageReleaseNotes>$(Description)</PackageReleaseNotes>
<RootNamespace>Microsoft.Diagnostics.Tools.Pgo</RootNamespace>
<RollForward>Major</RollForward>
<!-- TODO Remove the language version limitation when the reference assemblies
are updated with the new scoped keyword. -->
<LangVersion>10</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
11 changes: 5 additions & 6 deletions src/libraries/Common/tests/StaticTestGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,10 @@ public static void Main(string[] args)

// Write out the associated .csproj
string csprojPath = Path.Combine(outputPath, Path.GetFileNameWithoutExtension(testAssemblyPath) + "-runner.csproj");
Version version = Environment.Version;
File.WriteAllText(
csprojPath,
CSProjTemplate
GetCsprojTemplate($"net{version.Major}.{version.Minor}")
.Replace("#HelperAssemblyLocation#", Path.GetDirectoryName(testAssemblyPath) + Path.DirectorySeparatorChar)
.Replace("#TestAssembly#", Path.GetFullPath(testAssemblyPath))
.Replace("#TestAssemblyLocation#", testAssemblyPath));
Expand Down Expand Up @@ -1127,13 +1128,11 @@ public void WriteLine(string format, params object[] args)
}
";

/// <summary>The template for the .csproj.</summary>
private const string CSProjTemplate =
@"<Project Sdk=""Microsoft.NET.Sdk"">
private string GetCsprojTemplate(string targetFramework) =>
$@"<Project Sdk=""Microsoft.NET.Sdk"">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>preview</LangVersion>
<TargetFramework>{targetFramework}</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>IDE0049</NoWarn> <!-- names can be simplified -->
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<EnableDefaultItems>false</EnableDefaultItems>
<LangVersion>preview</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
<NoWarn>$(NoWarn);SA1205;CA1845</NoWarn>
<EnableTrimAnalyzer Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETFramework'">false</EnableTrimAnalyzer>
<IsPackable>true</IsPackable>
<!-- Lifetime rules introduced in C# 11 impact scenarios in net6 framework -->
<LangVersion Condition="'$(TargetFramework)' == 'net6.0'">10</LangVersion>
<EnableAOTAnalyzer>true</EnableAOTAnalyzer>
<PackageDescription>Provides Classes that allow you to decouple code logging rich (unserializable) diagnostics/telemetry (e.g. framework) from code that consumes it (e.g. tools)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<EnablePreviewFeatures>True</EnablePreviewFeatures>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>10.0</LangVersion>
<NoWarn>$(NoWarn);CS3001</NoWarn>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
<Nullable>enable</Nullable>
<LangVersion>9.0</LangVersion>

<!-- ilasm round-trip testing test failure: https://github.com/dotnet/runtime/issues/49985 -->
<IlasmRoundTripIncompatible>true</IlasmRoundTripIncompatible>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
<Nullable>enable</Nullable>
<LangVersion>9.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<!-- This is an explicit crossgen test -->
Expand Down

0 comments on commit 08d0bd9

Please sign in to comment.