nuget.org - 如何在使用Update-Package时防止下载未列出的软件包

时间:2018-06-03 14:19:36

标签: visual-studio nuget manage-nuget-packages

我在Nuget.org上创建了一个包 但是,在执行第一个版本之一时,我使用了一个不正确的汇编版本格式 - 它被用作包版本。

假设该版本为1.0.180305.0(构建日期)
但是,我不想使用这种格式,我想要一个更简单的东西与Major.Minor.BuildNumber格式,即1.0.10,1.0.11,1.0.12等,其中我手动增加主要和次要和增加编号自动。

我已经不公开1.0.180305.0版本,因此它不会出现在任何地方。

这一切都正常,但是在Package Manager控制台中使用Update-Package [PackageName]时,它会自动获得1.0.180305.0 - 即使它未列出 - 因为版本号是“更大”。

如何防止这种情况?

1 个答案:

答案 0 :(得分:1)

nuget.org - how to prevent unlisted package from being downloaded when Update-Package is being used

This is a known issue about Package Manager Console in Visual Studio not filtering out unlisted packages on Update-Package commands.

The current workaround is using the command line: Uninstall-Package [-Id] and then Install-Package [-Id]

Issue 4553: https://github.com/NuGet/Home/issues/4553

Besides, this issue was fixed at Visual Studio 2017 15.6.0 preview3 (Current version is 15.7.3), I test it in my side with Visual Studio 2017 15.6.6, this issue no longer occurs. So you can also update Visual Studio to resolve this issue.

Hope this helps.