NuGet/Home

Produce warning when a IsPackableProject=true references IsPackable=false project

Open

#9 797 ouverte le 14 juil. 2020

Voir sur GitHub
 (0 commentaires) (5 réactions) (0 assignés)HTML (292 forks)batch import
Priority:3Product:dotnet.exeType:Bughelp wanted

Métriques du dépôt

Stars
 (1 459 stars)
Métriques de merge PR
 (Merge moyen 464j 23h) (1 PR mergée en 30 j)

Description

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): dotnet.exe dotnet.exe --version (if appropriate): 3.1.200

Worked before? If so, with which NuGet version: No

Detailed repro steps so we can see the same problem

  1. Create two projects, Packable and NonPackable

Packable.csproj

<IsPackable>true</IsPackable>
<ProjectReference Include="NonPackable.csproj" />

NonPackable.csproj false

This configuration will produce a "Packable.nupkg" that can't ever work, because "NonPackable" doesn't (and won't ever) exist, because it's not packable. But the build doesn't produce any sort of warning, and everything works fine locally because of the PackagReference. The only time you notice it fails is when it gets pushed to a feed, like nuget.org, and then tries to resolve the NonPackable package. That's really late in the process to get notified of such a dangerous issue.

It would be great if the build could product a warning when this happens. It happens a lot in a repository I manage, because we have a service, as well as some utility DLL's for accessing that server, in the same repository. The service DLL's are not packable, but the helper DLL's go to a feed. But it's easy in VS to accidentally add a reference to a "shared" DLL that contains some utilities or something, that was previously only referenced by the service, so wasn't packable, and then publish bad packages to the feed, and I had to scramble to fix that.

Guide contributeur