Visual Studio 2017 无法更新 Microsoft.NETCore.App 包(“被项目阻止") [英] Visual Studio 2017 cannot update Microsoft.NETCore.App package ("Blocked by project")

查看:50
本文介绍了Visual Studio 2017 无法更新 Microsoft.NETCore.App 包(“被项目阻止")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个针对 Microsoft.NETCore.App 1.1.2 的 dotnet 核心应用程序.我创建了一个测试项目来测试该项目,但是在构建时我注意到了这个警告:

I have a dotnet core app that is targetting Microsoft.NETCore.App 1.1.2. I created a test project to test against that project but when building I noticed this warning:

我打开 NuGet 包管理器并看到警告是正确的,正在测试的项目具有不同版本的 Microsoft.NETCore.App:

I open the NuGet Package Manager and see that warning is correct, the project being tested has a different version of Microsoft.NETCore.App:

我的问题是 Visual Studio 不允许我更新那个版本,所以我对如何解决这个问题感到困惑:理想情况下,我只需单击下拉菜单并选择正确的版本,但 Visual Studio 声称由于项目或 packages.config 中的其他约束"而无法执行此操作.我应该如何更新该软件包?Visual Studio 指的是什么附加约束"?

My problem is that Visual Studio is not letting me update that version, so I'm confused on how to solve this issue: Ideally I would just click the dropdown and select the right version but Visual Studio claims that it cannot do this because of "additional constraints in the project or packages.config". How am I supposed to update that package? What "additional constraints" is Visual Studio referring to?

推荐答案

EDIT 2018:只有在你真的知道自己在做什么的情况下,才按照更新包的说明进行操作.在大多数情况下,您永远不需要手动更新此包或其他标记为被项目阻止"的包.依赖于框架的应用程序将使用可用的最新运行时,而自包含应用程序将使用此包的较新版本自动执行额外的构建.(在某些极端情况下,您需要在测试项目中升级此包.在这种情况下,添加 <TargetLatestRuntimePatch>true</...>查看此问答了解其他选项)

EDIT 2018: Only follow the instructions for updating the package if you really know what you are doing. In most cases, you never need to update this package - or other packages marked as "blocked by project" - manually. A framework-dependent app will use the latest runtime available and a self-contained application will perform an extra build using a newer version of this package automatically. (there are some edge cases where you need to upgrade this package in test projects. in this case, add <TargetLatestRuntimePatch>true</…> and see this Q&A for other options)

Microsoft.NET.Sdk 推断的隐式包引用无法通过 NuGet 更新.

The implicit package references that the Microsoft.NET.Sdk infers can't be updated via NuGet.

如果您从 project.json 迁移,则具有 1.1.0 引用的项目可能包含

If you migrated from project.json, the project with the 1.1.0 reference likely contains

<RuntimeFrameworkVersion>1.1.0</RuntimeFrameworkVersion>

在 csproj 文件或类似的项目中(如果您之前可能使用包管理器来设置版本):

in the csproj file or an item like this (if you may used the package manager previously to set the version):

<PackageReference Update="Microsoft.NETCore.App" Version="1.1.0" />

删除上述条目,所有包将自动引用 1.1.2(或任何已安装的 SDK 认为是最新的).或者,在所有项目中设置 RuntimeFrameworkVersion.

Delete entries like the above and all packages will reference 1.1.2 (or whatever the installed SDK considers to be the latest) automatically. Alernatively, set RuntimeFrameworkVersion in all projects.

这篇关于Visual Studio 2017 无法更新 Microsoft.NETCore.App 包(“被项目阻止")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆