问题描述
目前我有一个用 c# 制作的微服务,带有 web api 和 net core 2.0
at the moment I have a microservice made in c # with web api and net core 2.0
在 nutget 包中,我已经找到了 2.1 版的 net core,我决定安装它,以更新我的应用程序.我改变了目标如下图
in the nutget packages I have already found a version 2.1 of net core and I have decided to install it, in order to update my app. I changed the target as shown below
但是当我尝试编译它时会产生这个错误
But when I try to compile it generates this bug
项目是使用 Microsoft.NETCore.App 版本 2.1.0 恢复的,但在当前设置下,将使用版本 2.1.0-rtm-26515-03.要解决此问题,请确保将相同的设置用于还原和后续操作(例如构建或发布).如果在构建或发布期间而不是在还原期间设置了 RuntimeIdentifier 属性,通常会出现此问题.
The project was restored using Microsoft.NETCore.App version 2.1.0, but with current settings, version 2.1.0-rtm-26515-03 would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore.
我的依赖关系仍然如此
推荐答案
使用 Microsoft.NETCore.App 版本 2.1.0 恢复项目,但在当前设置下,将使用版本 2.1.0-rtm-26515-03
The project was restored using Microsoft.NETCore.App version 2.1.0, but with current settings, version 2.1.0-rtm-26515-03 would be used instead
目前这是一个已知问题.要解决此问题,您可以尝试以下解决方法:
This is a known issue at this moment. To resolve this issue, you can try following workarounds:
在
.csproj
文件中添加TargetLatestRuntimePatch
属性:
<PropertyGroup>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>
或者
在
.csproj
中设置RuntimeFrameworkVersion
和RuntimeIdentifier
文件:
<PropertyGroup>
<RuntimeFrameworkVersion>2.1.1</RuntimeFrameworkVersion>
<PlatformTarget>AnyCPU</PlatformTarget>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
如果上述解决方法不适合您,请查看调查问题上的更多解决方法.
If above workaround not work for you, please check more workarounds on the investigation issue.
有关详细信息,请参阅自包含部署运行时前滚.
See Self-contained deployment runtime roll forward for more information.
这篇关于该项目使用 Microsoft.NETCore.App 版本 2.1.0 恢复,但使用当前设置,将使用版本 2.1.0-rtm-26515-03的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!