Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Msbuild 将Azure管道与多目标项目一起使用时,我收到错误NETSDK1061_Msbuild_Azure Devops_Nuget_Azure Pipelines - Fatal编程技术网

Msbuild 将Azure管道与多目标项目一起使用时,我收到错误NETSDK1061

Msbuild 将Azure管道与多目标项目一起使用时,我收到错误NETSDK1061,msbuild,azure-devops,nuget,azure-pipelines,Msbuild,Azure Devops,Nuget,Azure Pipelines,完全错误如下: Error : NETSDK1061: The project was restored using Microsoft.NETCore.App version 1.0.0, but with current settings, version 2.2.0 would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequen

完全错误如下:

Error : NETSDK1061: The project was restored using Microsoft.NETCore.App version 1.0.0, but with current settings, version 2.2.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.
For more information, see https://aka.ms/dotnet-runtime-patch-selection.
在本地,一切看起来都很好,但在Azure上它不想编译。 我在网上找到的所有建议解决方案都没有帮助,包括:

- script: dotnet restore
- setting the <RuntimeFrameworkVersion>2.2.104</RuntimeFrameworkVersion> to the version I use.
- setting the <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
项目文件包含以下内容:

<PropertyGroup>
    <TargetFrameworks>netcoreapp2.2;net45</TargetFrameworks>
    <LangVersion>latest</LangVersion>
    <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>

netcoreapp2.2;网络45
最新的
真的

不久前我也遇到了同样的问题,我注意到一件事是,用于恢复软件包的nuget版本被修复为4.3.0(我认为这是一个默认建议)。我尝试使用更新的版本,如下所示:

- task: NuGetToolInstaller@0
  inputs:
    versionSpec: '>=4.3.0'
    checkLatest: true

更改后,构建被修复。在日志中,我注意到正在使用5.2.0版,尽管在本地我只能获得5.1.0版(带有“nuget update-self”)。

今天我在一个解决方案中添加了一个2.1核心项目,其中所有其他项目都是框架4.7.2,我尝试了它,它真的很有效!谢谢,你救了我一天!如果解决方案中的所有项目都是SDK样式的项目,则可以使用
dotnet restore
而不是
nuget restore
。如果SDK版本可以构建您的项目,那么恢复也可以工作,您不必担心另一个组件的版本号。我尝试了您的建议,请参阅我的yaml文件。问题是SDK无法构建我的解决方案,因为它同时面向.NET标准和.NET 4.5。您先生/女士刚刚为我节省了数小时的徒劳调试。我很怀疑我自己能解决这个问题。非常感谢。在管道中升级我的nuget.exe版本就成功了
- task: NuGetToolInstaller@0
  inputs:
    versionSpec: '>=4.3.0'
    checkLatest: true