您的位置 首页 asp.Net

asp.net-core – 构建asp.net核心错误

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

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 build 15.7.0

解决方法

我有类似的错误消息:

The project was restored using Microsoft.NETCore.App version 2.0.7,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文件中,它为我修复了一个问题:

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

关于作者: dawei

【声明】:金华站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

热门文章