Produce warning when a IsPackableProject=true references IsPackable=false project
#9,797 opened on 2020年7月14日
Repository metrics
- Stars
- (1,459 stars)
- PR merge metrics
- (平均マージ 464d 23h) (30d で 1 merged PR)
説明
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
- 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.