asp.net核心的构建错误 [英] build error of asp.net core

查看:88
本文介绍了asp.net核心的构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用dotnet创建了一个示例项目,但是在构建项目时出现以下错误:

I've created a sample project using dotnet, but I get the following error when build the project:


error:项目已使用Microsoft.NETCore.App版本2.1.0-rc1还原,但使用当前设置,将改用版本2.1.0-preview3-26411-06。要解决此问题,请确保将相同的设置用于还原以及后续操作(例如构建或发布)。通常,如果在构建或发布过程中设置了RuntimeIdentifier属性,但未在还原过程中设置了RuntimeIdentifier属性,则可能会发生此问题。

error : The project was restored using Microsoft.NETCore.App version 2.1.0-rc1, but with current settings, version 2.1.0-preview3-26411-06 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.

问题是什么?我正在使用VS 2017内部版本15.7.0

What's the problem? I'm using VS 2017 build 15.7.0

推荐答案

我也遇到了类似的错误消息:

I had similar error message:


使用Microsoft.NETCore.App版本2.0.7还原了该项目,但是使用当前设置,将改用版本2.0.0。要解决此问题,请确保将相同的设置用于还原以及后续操作(例如构建或发布)。通常,如果在构建或发布过程中设置了RuntimeIdentifier属性,但在还原过程中未设置RuntimeIdentifier属性,则会发生此问题。

The project was restored using Microsoft.NETCore.App version 2.0.7, but with current settings, version 2.0.0 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

我将RuntimeFrameworkVersion设置添加到了.csproj文件中并为我解决了一个问题:

I added RuntimeFrameworkVersion setting to .csproj file and it fixed an issue for me:

<PropertyGroup>
   <TargetFramework>netcoreapp2.0</TargetFramework>
   <RuntimeFrameworkVersion>2.0.7</RuntimeFrameworkVersion><!--here is the fix-->
</PropertyGroup>

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

这篇关于asp.net核心的构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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