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.

贡献者指南