简体   繁体   English

Nuget中Installed和Version栏的含义管理求解决

[英]meaning of Installed and Version columns in Nuget manage for solution

What's the difference between "Version" and "Installed" in the package manager in Visual Studio? Visual Studio 中 package 管理器中的“版本”和“已安装”有什么区别? Sometimes "Version" is blank, for no reason that I can discern.有时“版本”是空白的,我无法辨别原因。

解决方案的包管理器

per the shared screenshot and you are managing packages for solutions.根据共享的屏幕截图,您正在管理解决方案的包。 You installed the version '17.0.6' of this specific package for the project 'Business_core' and 'CboDbProvider_core', then the 'Version' and 'Installed' is '17.0.6'(they are the same for the same project in here).您为项目“Business_core”和“CboDbProvider_core”安装了此特定 package 的版本“17.0.6”,然后“版本”和“已安装”为“17.0.6”(对于此处的同一项目,它们是相同的) ). For other projects, they are 'Blank' since you have not installed this specific package, please have a look at this document: https://learn.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio#manage-packages-for-the-solution .对于其他项目,它们是“空白”,因为您尚未安装此特定的 package,请查看此文档: https://learn.microsoft.com/en-us/nuget/consume-packages/install-use- packages-visual-studio#manage-packages-for-the-solution

We can install and use different versions of the same NuGet package across different projects in the same solution like the following screenshot:我们可以在同一个解决方案的不同项目中安装和使用同一个 NuGet package 的不同版本,如下图所示: 在此处输入图像描述

Then select the specific project and click 'Version' to choose a higher or lower version to update the installed version:然后select具体项目点击'Version'选择高版本或者低版本来更新安装的版本:

在此处输入图像描述

"Version" means requested, whereas "installed" is what was actually restored. “版本”表示请求,而“安装”是实际恢复的内容。 This only makes sense for projects using ProjectReference.这仅对使用 ProjectReference 的项目有意义。 For packages.config they'll always be the same value.对于 packages.config,它们将始终是相同的值。

A demonstration of when the two columns have different versions (with PackageReference) is if you modify your csproj to contain <PackageReference Include="Newtonsoft.Json" Version="13.0.0" /> .如果您修改 csproj 以包含<PackageReference Include="Newtonsoft.Json" Version="13.0.0" />演示两列何时具有不同版本(使用 PackageReference)。 There is no version 13.0.0, the package author always starts with patch version 1, so NuGet will restore version 13.0.1 (and raise a warning).没有版本 13.0.0,package 作者始终从补丁版本 1 开始,因此 NuGet 将恢复版本 13.0.1(并发出警告)。 In this case you'll see the two columns have different values.在这种情况下,您会看到两列具有不同的值。

A more realistic example is if you use "floating versions".一个更现实的例子是如果你使用“浮动版本”。 For example, <PackageReference Include="Newtonsoft.Json" Version="13.*" /> .例如, <PackageReference Include="Newtonsoft.Json" Version="13.*" /> In the past VS would show the "installed" version as 13.0.0, but I think now it will show 13.*.过去 VS 会将“已安装”版本显示为 13.0.0,但我认为现在它会显示 13.*。 Note that floating versions have questions around when the package version will actually update once a new version is published to a feed your project uses, and also build determinism (more important when package authors don't follow SemVer and introduce breaking changes), so as someone who is risk adverse, I'd rather use Dependabot or similar, but different people have different preferences.请注意,浮动版本在 package 版本发布到您的项目使用的提要后何时实际更新存在疑问,并且还建立确定性(当 package 作者不遵循 SemVer 并引入重大更改时更重要),因此对于风险不利的人,我宁愿使用 Dependabot 或类似工具,但不同的人有不同的偏好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Nuget包安装在项目解决方案之外 - Nuget packages are installed outside of the project solution Nuget,比较已安装版本与最新版本 - Nuget, compare installed vs latest version 在 Visual Studio 中单击“Manage Nuget Packages for Solution”时没有响应 - No response when clicking on "Manage Nuget Packages for Solution" in Visual Studio NuGet包安装在解决方案级别而不是项目级别 - NuGet package installed on the solution level instead of project level 整个解决方案如何处理NuGet依赖版本解析 - How to handle NuGet dependency version resolution for the whole solution Visual Studio已安装产品的版本号是什么意思? - What is the meaning of Visual Studio Installed products version numbers? 安装时在目标程序集中读取 nuget package 库版本 - Read a nuget package library version in the target assembly when installed Visual Studio 找不到已安装的 SDK(10.0.17763.0) 版本的解决方案 - Visual Studio can't find Installed version of SDK(10.0.17763.0) for a solution 我似乎无法访问我在 Nuget package 安装程序中安装的软件包 - I can't seem to access packages I've installed inside the Nuget package installer for the solution 为什么“管理Nuget包”窗口仍然提供更新项目,如果它的版本受到约束? - Why the “Manage Nuget Packages” window still offers updating a project if its version is constrained?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM