Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4766 - Support netstandard2.0 when using net6.0 utility #4779

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
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