Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ internal async Task GenerateProjectAsync(bool keepBootstrapperDir, ILogger logge
// Don't treat warnings as errors so the bootstrapper will succeed as often as possible.
this.MSBuildProj.ClearWarningsAsErrors();

// Nullable requires newer lang versions.
this.MSBuildProj.SetLangVersion();

await this.MSBuildProj.SaveAsync(logger, cancellationToken).ConfigureAwait(false);
}

Expand Down
6 changes: 6 additions & 0 deletions src/dotnet-svcutil/lib/src/Shared/MSBuildProj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,12 @@ public void ClearWarningsAsErrors()
SetPropertyValue("WarningsAsErrors", string.Empty);
}

public void SetLangVersion()
{
// netstandard2.0 will throw an error saying default 7.3 lang version is too low, requiring 8 or higher.
SetPropertyValue("LangVersion", "latest");
}

private void UpdateTargetFramework(string targetFramework)
{
if (_targetFramework != targetFramework && !string.IsNullOrWhiteSpace(targetFramework))
Expand Down