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

State of dotnet/arcade's NuGet dependencies: how to use NuGet.Packaging in a new build task #6014

Open
2 tasks
Tracked by #2053
dagood opened this issue Aug 21, 2020 · 2 comments
Open
2 tasks
Tracked by #2053
Milestone

Comments

@dagood
Copy link
Member

dagood commented Aug 21, 2020

  • This issue is blocking
  • This issue is causing unreasonable pain

Right now, it looks like a one-word summary of the NuGet dependencies in dotnet/arcade is "fragile"--but this is nothing new or surprising. This repo has two different versions of NuGet packages that it uses:

<NuGetVersioningVersion>4.4.0</NuGetVersioningVersion>
<NuGetVersion>5.6.0-preview.2.6489</NuGetVersion>

The Arcade SDK uses only NuGetVersioningVersion:

<PackageReference Include="NuGet.Versioning" Version="$(NuGetVersioningVersion)" />

NuGetVersion shows up in other SDK projects and MSBuild extension projects, and it's used for various NuGet package IDs.

There's also the long thread at #1965 that ended up with this workaround:

<!-- Exclude NuGet package assemblies per https://github.com/dotnet/arcade/issues/1965
This is a workaround for https://github.com/microsoft/msbuild/issues/5073. Required until #5073 is fixed or
https://github.com/microsoft/msbuild/issues/5086 is available and we switch to that workaround -->
<Target Name="ExcludeNuGetPackagesFromNetCore" BeforeTargets="GenerateNuspec">
<ItemGroup>
<_PackageFilesToExclude Include="%(_PackageFiles.Identity)" Condition="$([System.String]::Copy('%(_PackageFiles.FileName)').StartsWith('NuGet')) and $([System.String]::Copy('%(_PackageFiles.Directory)').Contains('$(_ExcludeNuGetAssembliesTargetFramework)'))" />
</ItemGroup>
</Target>

Q's

My first impression is that I shouldn't touch this at all. If I need to use NuGet.Packaging, instead of putting my task in the Arcade SDK, I should set up a new SDK or MSBuild extension project and use it there. Does this sound like a good precaution? For now I'm assuming it's what I have to do (and that it'll be sufficient to avoid problems...)

Is this something that should be revisited/simplified? I see dotnet/msbuild#5073 (bug) is still open, but dotnet/msbuild#5086 (workaround mentioned in the comment) is closed and presumably available. However... I don't know if this only addresses the workaround target, or also the underlying fragility and two-version usage.

/cc @chcosta @rainersigwald

@chcosta
Copy link
Member

chcosta commented Aug 21, 2020

Today, in Arcade, the above workaround means that if you need to use NuGet.Packaging, you use the one that comes with the dotnet sdk instead of whatever your package specified. if you needed a newer version of NuGet.Packaging, you'd have to update the dotnet sdk that you're running on. Is that sufficient?

Last I heard, I thought there was an option to ease the version matching for assembly loading, but yeah, Rainer would probably know better and if we can / should revisit this.

@dagood
Copy link
Member Author

dagood commented Aug 21, 2020

Today, in Arcade, the above workaround means that if you need to use NuGet.Packaging, you use the one that comes with the dotnet sdk instead of whatever your package specified. if you needed a newer version of NuGet.Packaging, you'd have to update the dotnet sdk that you're running on. Is that sufficient?

Yep. (For source-build in particular, we actually directly compile against the SDK's DLLs to avoid having to deal with maintaining dependency versions that match what the SDK happens to include. But tightly binding with a specific SDK's DLLs is only reasonable because we don't distribute our task DLLs.)

A concern is that if I add a usage of a NuGet 4.4.0 API to the Arcade SDK, the .NET SDK might include 5.78.0-*, and the API is no longer binary compatible and breaks someone's build. I'm not sure how to verify this. It seems like the Arcade SDK is assuming the 4.4.0 API will always be forward-compatible, and the projects that compile against 5.6.0-* are closer to the .NET SDK, but still assuming compat.

@michellemcdaniel michellemcdaniel mentioned this issue Feb 14, 2022
74 tasks
mmitche added a commit to mmitche/arcade that referenced this issue Jan 26, 2023
After the sleet removal, we should be able to remove a long standing workound that required that the arcade SDK load a very old version on NuGet.Versioning because of a conflicting dependency with sleet.  I have unified the references under NuGet.Packaging's version, so that source-build can properly override the NuGet version.

The relevant issues around the old workaround are dotnet#6014 and dotnet#1965
mmitche added a commit to mmitche/arcade that referenced this issue Jan 26, 2023
After the sleet removal, we should be able to remove a long standing workound that required that the arcade SDK load a very old version on NuGet.Versioning because of a conflicting dependency with sleet.  I have unified the references under NuGet.Packaging's version, so that source-build can properly override the NuGet version.

The relevant issues around the old workaround are dotnet#6014 and dotnet#1965
mmitche added a commit that referenced this issue Jan 26, 2023
After the sleet removal, we should be able to remove a long standing workound that required that the arcade SDK load a very old version on NuGet.Versioning because of a conflicting dependency with sleet.  I have unified the references under NuGet.Packaging's version, so that source-build can properly override the NuGet version.

The relevant issues around the old workaround are #6014 and #1965
dotnet-bot pushed a commit to dotnet/dotnet that referenced this issue Jan 27, 2023
After the sleet removal, we should be able to remove a long standing workound that required that the arcade SDK load a very old version on NuGet.Versioning because of a conflicting dependency with sleet.  I have unified the references under NuGet.Packaging's version, so that source-build can properly override the NuGet version.

The relevant issues around the old workaround are dotnet/arcade#6014 and dotnet/arcade#1965

Original commit: dotnet/arcade@3900335

[[ commit created by automation ]]
@missymessa missymessa added this to the Arcade SDK milestone Apr 24, 2024
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

No branches or pull requests

3 participants