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

[build] update $(MSBuildPackageReferenceVersion) to 17.6.3 #221

Merged
merged 4 commits into from
Nov 30, 2023

Conversation

jonathanpeppers
Copy link
Member

In xamarin/xamarin-android, we need to update MSBuild.StructuredLogger to be able to move to .NET 9. The .binlog file format changed in .NET 9.

It currently fails with:

(Restore target) ->
tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605: Warning As Error: Detected package downgrade: Microsoft.Build.Framework from 17.5.0 to 17.3.2. Reference the package directly from the project to select a different version.
tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> MSBuild.StructuredLogger 2.2.100 -> Microsoft.Build.Framework (>= 17.5.0)
tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> Microsoft.Build.Framework (>= 17.3.2)
tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605: Warning As Error: Detected package downgrade: Microsoft.Build.Utilities.Core from 17.5.0 to 17.3.2. Reference the package directly from the project to select a different version.
tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> MSBuild.StructuredLogger 2.2.100 -> Microsoft.Build.Utilities.Core (>= 17.5.0)
tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> Microsoft.Build.Utilities.Core (>= 17.3.2)

Since a lot of other repos depend on xamarin-android-tools, I feel we should move to a new version, but not actually the newest. If we moved to 17.8.3, we could potentially break other repos.

VS 2022 17.6 is an LTS release that feels "safe", is new enough to solve the issue, and hopefully won't break anyone?

In xamarin/xamarin-android, we need to update `MSBuild.StructuredLogger`
to be able to move to .NET 9. The `.binlog` file format changed in .NET 9.

It currently fails with:

    (Restore target) ->
    tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605: Warning As Error: Detected package downgrade: Microsoft.Build.Framework from 17.5.0 to 17.3.2. Reference the package directly from the project to select a different version.
    tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> MSBuild.StructuredLogger 2.2.100 -> Microsoft.Build.Framework (>= 17.5.0)
    tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> Microsoft.Build.Framework (>= 17.3.2)
    tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605: Warning As Error: Detected package downgrade: Microsoft.Build.Utilities.Core from 17.5.0 to 17.3.2. Reference the package directly from the project to select a different version.
    tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> MSBuild.StructuredLogger 2.2.100 -> Microsoft.Build.Utilities.Core (>= 17.5.0)
    tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> Microsoft.Build.Utilities.Core (>= 17.3.2)

Since a lot of other repos depend on xamarin-android-tools, I feel we
should move to a new version, but not actually the newest. If we moved
to 17.8.3, we could potentially break other repos.

VS 2022 17.6 is an LTS release that feels "safe", is new enough to solve
the issue, and hopefully won't break anyone?
src\Microsoft.Android.Build.BaseTasks\Microsoft.Android.Build.BaseTasks.csproj : error NU1605: Detected package downgrade: System.Security.Cryptography.Xml from 7.0.1 to 6.0.1. Reference the package directly from the project to select a different version.
src\Microsoft.Android.Build.BaseTasks\Microsoft.Android.Build.BaseTasks.csproj : error NU1605:  Microsoft.Android.Build.BaseTasks -> Microsoft.Build.Tasks.Core 17.6.3 -> System.Security.Cryptography.Xml (>= 7.0.1)
src\Microsoft.Android.Build.BaseTasks\Microsoft.Android.Build.BaseTasks.csproj : error NU1605:  Microsoft.Android.Build.BaseTasks -> System.Security.Cryptography.Xml (>= 6.0.1)
tests\Microsoft.Android.Build.BaseTasks-Tests\Microsoft.Android.Build.BaseTasks-Tests.csproj : error NU1605: Detected package downgrade: System.Security.Cryptography.Xml from 7.0.1 to 6.0.1. Reference the package directly from the project to select a different version.
tests\Microsoft.Android.Build.BaseTasks-Tests\Microsoft.Android.Build.BaseTasks-Tests.csproj : error NU1605:  Microsoft.Android.Build.BaseTasks-Tests -> Microsoft.Build.Tasks.Core 17.6.3 -> System.Security.Cryptography.Xml (>= 7.0.1)
tests\Microsoft.Android.Build.BaseTasks-Tests\Microsoft.Android.Build.BaseTasks-Tests.csproj : error NU1605:  Microsoft.Android.Build.BaseTasks-Tests -> System.Security.Cryptography.Xml (>= 6.0.1)
@jonpryor jonpryor merged commit 21de3d7 into dotnet:main Nov 30, 2023
4 checks passed
@jonathanpeppers jonathanpeppers deleted the MSBuildPackageReferenceVersion branch November 30, 2023 16:22
jonpryor pushed a commit to dotnet/java-interop that referenced this pull request Dec 2, 2023
Changes: dotnet/android-tools@8d38281...4889bf0

  * dotnet/android-tools@4889bf0: [MSBuildReferences.projitems] Require opt-in to use `Microsoft.Build` (dotnet/android-tools#220)
  * dotnet/android-tools@21de3d7: [build] update $(MSBuildPackageReferenceVersion) to 17.6.3 (dotnet/android-tools#221)
  * dotnet/android-tools@08a6990: Bump android-sdk NDK version to 26.1.10909125
  * dotnet/android-tools@6ae1f2a: Bump android-sdk build-tool version to 34.0.0
  * dotnet/android-tools@184b6b3: Bump android-sdk cmdline-tools to version 11.0
  * dotnet/android-tools@1365e33: Bump android-sdk platforms-tools to version 34.0.5

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
jonpryor pushed a commit to dotnet/android that referenced this pull request Dec 4, 2023
Changes: dotnet/installer@e1fd7d9...42ace91

	% git diff --shortstat e1fd7d9649...42ace91ba7
	 182 files changed, 8428 insertions(+), 2413 deletions(-)

Changes: dotnet/runtime@287c10d...a26802a

	% git diff --shortstat 287c10d253...a26802aa57
	 10852 files changed, 266698 insertions(+), 198289 deletions(-)

Changes: dotnet/emsdk@1999c8c...74e4868

	% git diff --shortstat 1999c8c8ab...74e4868be8
	 39 files changed, 616 insertions(+), 260 deletions(-)

Changes: dotnet/cecil@a112f15...45dd3a7

  * dotnet/cecil@45dd3a7: [main] Update dependencies from dotnet/source-build-reference-packages (dotnet/cecil#116)
  * dotnet/cecil@0b78015: Update dependencies from https://github.com/dotnet/arcade build 20231008.1 (dotnet/cecil#115)
  * dotnet/cecil@64a8874: [main] Update dependencies from dotnet/source-build-reference-packages (dotnet/cecil#114)
  * dotnet/cecil@13d6536: [main] Update dependencies from dotnet/source-build-reference-packages (dotnet/cecil#113)
  * dotnet/cecil@89be445: [main] Update dependencies from dotnet/source-build-reference-packages (dotnet/cecil#112)
  * dotnet/cecil@84f4527: Update dependencies from https://github.com/dotnet/arcade build 20230913.1 (dotnet/cecil#111)

Changes: dotnet/android-tools@08a6990...21de3d7

  * dotnet/android-tools@21de3d7: [build] update $(MSBuildPackageReferenceVersion) to 17.6.3 (dotnet/android-tools#221)

Updates:

  * Microsoft.Dotnet.Sdk.Internal: from 8.0.100-rc.2.23468.1 to 9.0.100-alpha.1.23603.1
  * Microsoft.NETCore.App.Ref: from 8.0.0-rc.2.23466.4 to 9.0.0-alpha.1.23577.7
  * Microsoft.NET.Workload.Emscripten.Current.Manifest-*.Transport: from 8.0.0-rc.2.23463.1 to 9.0.0-alpha.1.23572.3
  * Microsoft.DotNet.Cecil: from 0.11.4-alpha.23461.1 to 0.11.4-alpha.23509.2

~~ Changes to the build ~~

`$(DotNetTargetFrameworkVersion)` is `9.0`, making assemblies like
`Mono.Android.dll` target .NET 9.0, as well as `$(TargetFramework)`
in project templates, etc.

`$(DotNetStableTargetFramework)` is `8.0`, making various bootstrap
tooling, command-line tools, and unit tests target .NET 8.0.

.NET 9 has a new `.binlog` format, requiring
`MSBuild.StructuredLogger` 2.2.100.

`System.CodeDom` now targets 8.0.0, as we moved to 17.8 MSBuild
assemblies from `xamarin-android-tools`.

Add the `dotnet9` and `dotnet9-transport` feeds. The
`dotnet9-transport` feed is used for non-customer-facing packages
like `Microsoft.NET.ILLink`.

`build-linux.yaml` was initially failing to restore `net8.0`
projects because of the order it installed a .NET SDK. It was only
working for `net7.0` projects, because a .NET 7 SDK was
preinstalled on the build machines.

Update `TestSlicerToolVersion` and `dotnet-test-slicer` to
`0.1.0-alpha7`, previously it was failing to discover tests in a
`net8.0` project.

Provision Mono workload manifests for: `net6`, `net7`, `net8`, and
`current` (`net9`).  Call `Utilities.DeleteDirectory()` on these
directories to be sure we are in a clean state.

dotnet/android-tools@21de3d7 is needed to fix various
NU1605 warnings:

	error NU1605: Warning As Error: Detected package downgrade: Microsoft.Build.Framework from 17.5.0 to 17.3.2. Reference the package directly from the project to select a different version.
	error NU1605:  MSBuildDeviceIntegration -> MSBuild.StructuredLogger 2.2.100 -> doh (>= 17.5.0)
	error NU1605:  MSBuildDeviceIntegration -> Microsoft.Build.Framework (>= 17.3.2)

Update workload aliases to include `Microsoft.Android.Sdk.net9` and
`Microsoft.Android.Sdk.net8`.

Remove the .NET 7 Android workload from .NET 9.
Import `Eol.targets` for .NET 6/7 projects.

Update various parameterized tests to target `net8.0` and `net9.0`
appropriately while dropping `net7.0` support.

An initial update to the AOT profile for .NET 9.

Updated `*.apkdesc` files: there were some minor `.apk`
size changes.


~~ `$(AllowSelfContainedWithoutRuntimeIdentifier)` ~~

Context: dotnet/sdk@d21e6bf
Context: d12da3a

@rolfbjarne introduced an "escape hatch" in the .NET 9 SDK for emitting
a build warning for a case that doesn't make sense on mobile.
All mobile apps are self-contained, and we define RIDs by default, so
the error is not needed.

We can also stop setting `$(PublishSelfContained)` to `false`, as
`$(AllowSelfContainedWithoutRuntimeIdentifier)` is sufficient in .NET 9.


~~ Changes to `<ILStrip/>` ~~

Context: dotnet/runtime#90436

  * `$(IntermediateOutputPath)` is now required.

  * `[Output] TrimmedAssemblies` renamed to `UpdatedAssemblies`.

  * Output items shape changed, so now use
    `%(UntrimmedAssemblyFilePath)` and we can `<Copy/>` based on
    `%(ILStripped)`.

The new code is better, so generally these changes seem *good*.


~~ Refactoring ~~

Rename `$(AndroidNet7Version)` to `$(AndroidNetPreviousVersion)` to make
this property more generic for future releases.

Use `@NET_PREVIOUS_VERSION@` as a replacement instead of `@NET7_VERSION@`.


~~ TODO ~~

  * #8548

    The `MicrosoftIntune` test is failing because they have a check for
    == `8.0` that needs to be updated to be >= `8.0`.  This test is
    running on our `release/8.0.1xx` branch, but we can hopefully
    re-enable in main after their next release.

  * A specific case of `dotnet publish -f net8.0-android -r android-arm`
    is failing with:

        error NETSDK1185: The Runtime Pack for FrameworkReference 'Microsoft.Android.Runtime.34.android-arm' was not available. This may be because DisableTransitiveFrameworkReferenceDownloads was set to true.

    This is related to `$(AllowSelfContainedWithoutRuntimeIdentifier)`,
    but I will address in a future PR.  This will likely require .NET 8
    Android workload changes.
jonathanpeppers added a commit that referenced this pull request Feb 21, 2024
Context: dotnet/android#8366

dotnet/android#8366 is attempting to build xamarin-android
against .NET 9 previews, and currently fails:

	(Restore target) ->
	tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605: Warning As Error: Detected package downgrade: Microsoft.Build.Framework from 17.5.0 to 17.3.2. Reference the package directly from the project to select a different version.
	tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> MSBuild.StructuredLogger 2.2.100 -> doh (>= 17.5.0)
	tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> Microsoft.Build.Framework (>= 17.3.2)
	tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605: Warning As Error: Detected package downgrade: Microsoft.Build.Utilities.Core from 17.5.0 to 17.3.2. Reference the package directly from the project to select a different version.
	tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> MSBuild.StructuredLogger 2.2.100 -> Microsoft.Build.Utilities.Core (>= 17.5.0)
	tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj : error NU1605:  MSBuildDeviceIntegration -> Microsoft.Build.Utilities.Core (>= 17.3.2)

We need to update `MSBuild.StructuredLogger` package to be able to
move to .NET 9, as the `.binlog` file format changed in .NET 9.
The newer `MSBuild.StructuredLogger` package, in turn, requires a
newer `Microsoft.Build.Framework` package version, which is
controlled here.

Update the `$(MSBuildPackageReferenceVersion)` MSBuild property so
that (1) it can now be overridden, which would allow version updates
in the future without requiring submodule updates, and (2) update the
the default value to 17.6.3.  I fear that if we move to 17.8.3, we
may potentially break other repos.

VS 2022 17.6 is an LTS release that feels "safe", is new enough to solve
the issue, and hopefully won't break anyone?

Additionally, update the `System.Security.Cryptography.Xml` package
so that it now uses an overridable
`$(SystemSecurityCryptographyXmlVersion)` MSBuild property, which
defaults to 7.0.1, in order to fix this build error:

	src\Microsoft.Android.Build.BaseTasks\Microsoft.Android.Build.BaseTasks.csproj : error NU1605: Detected package downgrade: System.Security.Cryptography.Xml from 7.0.1 to 6.0.1. Reference the package directly from the project to select a different version.
	src\Microsoft.Android.Build.BaseTasks\Microsoft.Android.Build.BaseTasks.csproj : error NU1605:  Microsoft.Android.Build.BaseTasks -> Microsoft.Build.Tasks.Core 17.6.3 -> System.Security.Cryptography.Xml (>= 7.0.1)
	src\Microsoft.Android.Build.BaseTasks\Microsoft.Android.Build.BaseTasks.csproj : error NU1605:  Microsoft.Android.Build.BaseTasks -> System.Security.Cryptography.Xml (>= 6.0.1)
	tests\Microsoft.Android.Build.BaseTasks-Tests\Microsoft.Android.Build.BaseTasks-Tests.csproj : error NU1605: Detected package downgrade: System.Security.Cryptography.Xml from 7.0.1 to 6.0.1. Reference the package directly from the project to select a different version.
	tests\Microsoft.Android.Build.BaseTasks-Tests\Microsoft.Android.Build.BaseTasks-Tests.csproj : error NU1605:  Microsoft.Android.Build.BaseTasks-Tests -> Microsoft.Build.Tasks.Core 17.6.3 -> System.Security.Cryptography.Xml (>= 7.0.1)
	tests\Microsoft.Android.Build.BaseTasks-Tests\Microsoft.Android.Build.BaseTasks-Tests.csproj : error NU1605:  Microsoft.Android.Build.BaseTasks-Tests -> System.Security.Cryptography.Xml (>= 6.0.1)
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