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

NuGet.exe restore with a PackageReference with exclude=build only does not interpret it correctly. #9672

Open
nkolev92 opened this issue Jun 11, 2020 · 1 comment
Labels
Functionality:Restore Priority:2 Issues for the current backlog. Type:Bug

Comments

@nkolev92
Copy link
Member

Take an example project like:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="nuget.common" Version="5.6.0" ExcludeAssets="build" />
  </ItemGroup>
</Project>

NuGet.exe would restore with Include="all"
MSbuild.exe would restore with excludeassets build.

The problem is that the the flags don't round trip. See relevant code:

https://github.com/NuGet/NuGet.Client/blob/fc9dd52fcdf3c9a299a96de39b641b7c91779b5e/src/NuGet.Core/NuGet.LibraryModel/LibraryIncludeFlagUtils.cs#L26-L69

compile, runtime, contentFiles, native, analyzers, buildtransitive ends up being parsed to all.

@yiqiju
Copy link

yiqiju commented Sep 20, 2023

I work rounded this by inversing "ExcludeAssets" to "IncludeAssets". Basically you list all the types you want to include: compile and etcs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Restore Priority:2 Issues for the current backlog. Type:Bug
Projects
None yet
Development

No branches or pull requests

3 participants