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

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

问题描述

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



我的问题是Visual Studio不允许我更新该版本,所以我对如何解决此问题感到困惑:

理想情况下,我只是单击下拉列表并选择正确的版本,但是Visual Studio声称由于项目或packages.config中的其他约束,它无法执行此操作。我应该如何更新该软件包? Visual Studio指的是附加约束?

解决方案

EDIT 2018 :仅遵循说明如果您真的知道自己在做什么,则可以更新软件包。在大多数情况下,您无需手动更新此程序包或其他标记为被项目阻止的程序包。依赖于框架的应用程序将使用可用的最新运行时,而独立的应用程序将自动使用此程序包的较新版本执行额外的构建。 (在某些极端情况下,您需要在测试项目中升级此软件包。在这种情况下,请添加< TargetLatestRuntimePatch> true< /…> 有关其他选项,请参见此问题和解答



隐式包引用了 Microsoft.NET.Sdk 推断无法通过NuGet进行更新。



如果从project.json迁移,则该项目 1.1.0 引用可能包含

 < RuntimeFrameworkVersion> 1.1 .0< / RuntimeFrameworkVersion> csproj文件或类似项目中的

(如果您以前使用过程序包管理器来设置版本):

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

删除上述内容,所有软件包均引用 1.1.2 (或任何已安装的SDK认为是最新的)。
或者,在所有项目中设置 RuntimeFrameworkVersion


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:

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

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: 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)

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

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

<RuntimeFrameworkVersion>1.1.0</RuntimeFrameworkVersion>

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" />

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天全站免登陆