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

Make the build compatible with .NET 9 SDK #2840

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

nguerrera
Copy link
Contributor

@nguerrera nguerrera commented Nov 18, 2024

  • Move all warning-as-error handling to build props
  • Disable warning-as-error in Debug builds
  • Lower AnalysisLevel to .NET 8 wave when treating warnings as errors in Release
  • Pass --self-contained explicitly to dotnet publish with runtime identifier for forward compat

@@ -2,7 +2,10 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<LangVersion>8.0</LangVersion>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this was already reset to latest below this before.

@@ -38,7 +38,7 @@ $npmBuildFolder = "$BuildRoot\Publish\npm"
if (-not $SkipBuild) {
Write-Information "Building Sarif.Multitool for Windows, Linux, and MacOS..."
foreach ($runtime in "win-x64", "linux-x64", "osx-x64") {
dotnet publish $SourceRoot\$project\$project.csproj -c $Configuration -f netcoreapp3.1 -r $runtime
dotnet publish $SourceRoot\$project\$project.csproj -c $Configuration -f netcoreapp3.1 -r $runtime --self-contained
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes a .NET 9 SDK warning that tells us that --self-contained will no longer be the default as before when runtime identifier is specified.

* Move all warning-as-error handling to build props
* Disable warning-as-error in Debug builds
* Lower AnalysisLevel to .NET 8 wave when treating warnings as errors in Release
* Pass --self-contained explicitly to dotnet publish with runtime identifier for forward compat
@@ -0,0 +1,3 @@
<Project>
<Import Project="build.warnings_as_errors.props" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is maddeningly difficult to get the same behavior for building .sln as .csproj for these settings.

Copy link
Member

Choose a reason for hiding this comment

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

indeed!

Copy link
Member

@michaelcfanning michaelcfanning left a comment

Choose a reason for hiding this comment

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

:shipit:

@michaelcfanning michaelcfanning merged commit f9e0a4d into microsoft:main Nov 20, 2024
9 checks passed
@nguerrera nguerrera deleted the net9-sdk-compat branch November 20, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants