From 221342ba44bb07b2eddc0e99dad579d3611c9cf7 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Fri, 13 Aug 2021 10:40:46 -0500 Subject: [PATCH] [One .NET] use **FromWorkload** for targeting/runtime pack versions Context: https://github.com/dotnet/sdk/pull/19596 If we use the version number string of `**FromWorkload**`, then our runtime packages don't need to be resolved from a NuGet feed. They can be resolved from the `dotnet/packs` directory. This completely eliminates the need for a `NuGet.config` file when building a .NET 6 app with a local build of the Android workload. You can simply do: ~/android-toolchain/dotnet/dotnet new android ~/android-toolchain/dotnet/dotnet build --- Documentation/building/unix/instructions.md | 17 +---------------- Documentation/building/windows/instructions.md | 17 +---------------- .../create-packs/Microsoft.Android.Sdk.proj | 6 +++--- .../Common/XamarinProject.cs | 8 +------- 4 files changed, 6 insertions(+), 42 deletions(-) diff --git a/Documentation/building/unix/instructions.md b/Documentation/building/unix/instructions.md index e0e7bd26026..3a9586529ce 100644 --- a/Documentation/building/unix/instructions.md +++ b/Documentation/building/unix/instructions.md @@ -93,22 +93,7 @@ but this is only part of the story. Your local local Android "workload" in `Microsoft.Android.Sdk.$(HostOS)` matching your operating system. -To use the Android workload, you will need a `NuGet.config`: - -```xml - - - - - - - -``` - -The local package source in the `bin/BuildDebug/nuget-unsigned` directory is -currently needed for the Android runtime packages. - -Then use a `.csproj` file such as: +Create a new project with `dotnet new android`: ```xml diff --git a/Documentation/building/windows/instructions.md b/Documentation/building/windows/instructions.md index 6dbd24cfb95..5e290e9bd22 100644 --- a/Documentation/building/windows/instructions.md +++ b/Documentation/building/windows/instructions.md @@ -107,22 +107,7 @@ but this is only part of the story. Your local populated with a local Android "workload" in `Microsoft.Android.Sdk.$(HostOS)` matching your operating system. -To use the Android workload, you will need a `NuGet.config`: - -```xml - - - - - - - -``` - -The local package source in the `bin\BuildDebug\nuget-unsigned` directory is -currently needed for the Android runtime packages. - -Then use a `.csproj` file such as: +Create a new project with `dotnet new android`: ```xml diff --git a/build-tools/create-packs/Microsoft.Android.Sdk.proj b/build-tools/create-packs/Microsoft.Android.Sdk.proj index 131c1e82d77..63beba4ef40 100644 --- a/build-tools/create-packs/Microsoft.Android.Sdk.proj +++ b/build-tools/create-packs/Microsoft.Android.Sdk.proj @@ -114,10 +114,10 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and Include="Microsoft.Android" TargetFramework="$(_AndroidNETAppTargetFramework)" RuntimeFrameworkName="Microsoft.Android" - DefaultRuntimeFrameworkVersion="$(AndroidPackVersionLong)" - LatestRuntimeFrameworkVersion="$(AndroidPackVersionLong)" + DefaultRuntimeFrameworkVersion="**FromWorkload**" + LatestRuntimeFrameworkVersion="**FromWorkload**" TargetingPackName="Microsoft.Android.Ref" - TargetingPackVersion="$(AndroidPackVersionLong)" + TargetingPackVersion="**FromWorkload**" RuntimePackNamePatterns="Microsoft.Android.Runtime.**RID**" RuntimePackRuntimeIdentifiers="@(_AndroidNETAppRuntimePackRids, '%3B')" Profile="Android" diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/XamarinProject.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/XamarinProject.cs index bfc76260f5a..3813e959264 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/XamarinProject.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/XamarinProject.cs @@ -31,7 +31,7 @@ public abstract class XamarinProject public IList References { get; private set; } public IList PackageReferences { get; private set; } public string GlobalPackagesFolder { get; set; } = FileSystemUtils.FindNugetGlobalPackageFolder (); - public IList ExtraNuGetConfigSources { get; set; } + public IList ExtraNuGetConfigSources { get; set; } = new List (); public virtual bool ShouldRestorePackageReferences => PackageReferences?.Count > 0; /// @@ -98,12 +98,6 @@ public XamarinProject (string debugConfigurationName = "Debug", string releaseCo " }); - - // Feeds only needed for .NET 5+ - ExtraNuGetConfigSources = new List { - Path.Combine (XABuildPaths.BuildOutputDirectory, "nuget-unsigned"), - "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json", - }; } else { SetProperty (KnownProperties.Configuration, () => Configuration); }