NuGet/Home

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

Open

#9,797 建立於 2020年7月14日

在 GitHub 查看
 (0 留言) (5 反應) (0 負責人)HTML (292 fork)batch import
Priority:3Product:dotnet.exeType:Bughelp wanted

倉庫指標

Star
 (1,459 star)
PR 合併指標
 (平均合併 464天 23小時) (30 天內合併 1 個 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

  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.

貢獻者指南