Skip to content

Commit

Permalink
Revert "[build] Enable NuGet's Central Package Management (#1114)" (#…
Browse files Browse the repository at this point in the history
…1138)

Context: dotnet/android#8279

This reverts commit 8c9eece.

Near the end of .NET 8 RC 1, the .NET 8 SDK depends on nightly
packages for .NET 6 and .NET 7:

  * dotnet/runtime 7.0.11
  * dotnet/runtime 6.0.22

These come from feeds within `NuGet.config` such as:

	<packageSources>
	  <clear/>
	  <!-- Added manually for dotnet/runtime 7.0.11 -->
	  <add key="darc-pub-dotnet-runtime-a2ad4f0" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-a2ad4f03/nuget/v3/index.json" />
	  <!-- Added manually for dotnet/runtime 6.0.22 -->
	  <add key="darc-pub-dotnet-runtime-762f437" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-762f4379/nuget/v3/index.json" />
	</packageSources>

The version number is stable, so the .NET releng team has
infrastructure to create a new feed per git commit.

Unfortunately, this makes NuGet central package management unusable
for us. 😢

As seen in dotnet/android#8279, we get errors like:

	Package source mapping matches found for package ID 'Microsoft.NETCore.App.Ref' are: 'dotnet-public'.
	…
	external\Java.Interop\src\Java.Interop.Tools.Expressions\Java.Interop.Tools.Expressions.csproj error NU1102: Unable to find package Microsoft.NETCore.App.Ref with version (= 7.0.11)
	- Found 83 version(s) in dotnet-public [ Nearest version: 8.0.0-preview.1.23110.8 ]
	- Versions from dotnet-eng were not considered [Xamarin.Android.sln]

This is because it can only possibly resolve this package from
`dotnet-public`:

	<packageSourceMapping>
	  <packageSource key="dotnet-public">
	    <package pattern="*" />
	  </packageSource>
	</packageSourceMapping>

Because 7.0.11 hasn't shipped yet, it is on neither NuGet.org nor
`dotnet-public`.

For this to work, we would somehow need this `NuGet.config` fragment
to be added to the xamarin/java.interop repo whenever
xamarin/xamarin-android gets a newer .NET 8 SDK:

	<packageSourceMapping>
	  <packageSource key="darc-pub-dotnet-runtime-[HASH]">
	    <package pattern="Microsoft.NETCore.App.Ref" />
	  </packageSource>
	</packageSourceMapping>

For now, let's revert 8c9eece.  Maybe there is some solution we can
come up with to use this in the future.
  • Loading branch information
jonathanpeppers committed Aug 23, 2023
1 parent 7961b36 commit 7e3bd2f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 49 deletions.
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<DisableTransitiveFrameworkReferenceDownloads>true</DisableTransitiveFrameworkReferenceDownloads>
<DotNetTargetFrameworkVersion>7.0</DotNetTargetFrameworkVersion>
<DotNetTargetFramework>net$(DotNetTargetFrameworkVersion)</DotNetTargetFramework>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<Import
Expand Down
24 changes: 21 additions & 3 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,36 @@

<!-- Add Roslyn analyzers NuGet to all projects -->
<ItemGroup Condition=" '$(DisableRoslynAnalyzers)' != 'True' ">
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers">
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<!-- Set Assets for NUnit3TestAdapter -->
<!-- NuGet Dependencies -->
<ItemGroup>
<PackageReference Update="NUnit3TestAdapter">
<PackageReference Update="GitInfo" Version="2.1.2" />
<PackageReference Update="HtmlAgilityPack" Version="1.11.30" />
<PackageReference Update="Irony" Version="1.1.0" />
<PackageReference Update="Microsoft.Build.Framework" Version="17.3.2" />
<PackageReference Update="Microsoft.Build.Utilities.Core" Version="17.3.2" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
<PackageReference Update="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Update="Microsoft.DotNet.GenAPI" Version="7.0.0-beta.22103.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.5.0-preview-20221003-04" />
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageReference Update="Microsoft.Xml.SgmlReader" Version="1.8.16" />
<PackageReference Update="Mono.CSharp" Version="4.0.0.143" />
<PackageReference Update="Mono.Linq.Expressions" Version="2.0.0" />
<PackageReference Update="Mono.Options" Version="6.12.0.148" />
<PackageReference Update="Mono.Terminal" Version="5.4.2" />
<PackageReference Update="nunit" Version="3.13.2" />
<PackageReference Update="NUnit.ConsoleRunner" Version="3.12.0" />
<PackageReference Update="NUnit3TestAdapter" Version="4.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="protobuf-net" Version="2.4.4" />
</ItemGroup>

<Import Project="build-tools\scripts\VersionInfo.targets" />
Expand Down
31 changes: 0 additions & 31 deletions Directory.Packages.props

This file was deleted.

10 changes: 0 additions & 10 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,4 @@
<!-- For Microsoft.DotNet.GenAPI -->
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
</packageSources>

<packageSourceMapping>
<!-- key value for <packageSource> should match key values from <packageSources> element -->
<packageSource key="dotnet-public">
<package pattern="*" />
</packageSource>
<packageSource key="dotnet-eng">
<package pattern="Microsoft.DotNet.GenAPI" />
</packageSource>
</packageSourceMapping>
</configuration>
5 changes: 4 additions & 1 deletion build-tools/scripts/cecil.projitems
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_XamarinAndroidCecilVersion Condition=" '$(_XamarinAndroidCecilVersion)' == '' ">0.11.4</_XamarinAndroidCecilVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(_XamarinAndroidCecilPath)' == '' ">
<PackageReference Include="Mono.Cecil" />
<PackageReference Include="Mono.Cecil" Version="$(_XamarinAndroidCecilVersion)" />
</ItemGroup>
<ItemGroup Condition=" '$(_XamarinAndroidCecilPath)' != '' ">
<Reference Include="$(_XamarinAndroidCecilPath)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
<PackageReference Include="NUnit3TestAdapter" />
</ItemGroup>

<!--
<Import Project="..\..\build-tools\scripts\cecil.projitems" />
-->

<ItemGroup>
<PackageReference Include="Mono.Cecil" />
<PackageReference Include="Mono.Linq.Expressions" />
</ItemGroup>

Expand Down

0 comments on commit 7e3bd2f

Please sign in to comment.