我正在开发一个移动应用程序,并使用微软应用程序中心的CI。昨天,单元测试项目在App Center中构建失败,出现以下错误。我不能在任何开发者机器上重现这个问题,这个错误只在App Center中出现。
error : NETSDK1061: The project was restored using Microsoft.NETCore.App version 1.0.0, but with current settings, version 2.0.9 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. For more information, see https://aka.ms/dotnet-runtime-patch-selection.他们的付费支持只是提供基础知识,清理项目,回滚我的最后一次提交等。以前有没有人在App Center上遇到过这个问题?
发布于 2019-01-18 01:02:33
您需要设置相同的发布和构建运行时
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RuntimeFrameworkVersion>2.1.0</RuntimeFrameworkVersion> --> fix publishing issues
<PlatformTarget>AnyCPU</PlatformTarget> --> fix publishing issues
</PropertyGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="2.1.0" /> --> fix building issues
<ProjectReference Include="..\PublicSonar.Monitor.Persistent.Json\PublicSonar.Monitor.Persistent.Json.csproj" />
</ItemGroup>
</Project>发布于 2019-03-28 12:37:57
如果你使用Azure DevOps,不要编辑项目文件。使用"dotnet restore"(https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core?view=azure-devops)代替Nuget restore:
替换为:
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'有了这个:
- script: dotnet restore发布于 2019-04-10 06:04:51
我在Visual Studio 2019上。当我第二次尝试将我的项目发布为自包含项目时,我遇到了这个问题。
为了消除这个错误,我所做的是:
将项目的部署模式更改为框架Dependent
这似乎是由一些错误的缓存引起的,这些缓存可以通过切换到不同的部署模式来清除。
https://stackoverflow.com/questions/53720678
复制相似问题