VSTS上的Nuget恢复版本冲突生成错误

时间:2018-07-20 14:21:46

标签: .net-core azure-pipelines nuget-package-restore azure-pipelines-build-task

在本地构建良好,但在VSTS构建服务器上出现以下错误。问题很明显,但无法解决。

018-07-18T19:41:24.6993903Z ##[error]The nuget command failed with exit code(1) and error(NU1107: Version conflict detected for Microsoft.AspNetCore.Http.Abstractions. Reference the package directly from the project to resolve this issue. 
 webapi.admin -> Microsoft.AspNetCore.Cors 2.1.1 -> Microsoft.AspNetCore.Http.Extensions 2.1.1 -> Microsoft.AspNetCore.Http.Abstractions (>= 2.1.1) 
 webapi.admin -> Microsoft.AspNetCore.App 2.1.0 -> Microsoft.AspNetCore.Http.Abstractions (= 2.1.0).

3 个答案:

答案 0 :(得分:1)

您可以将Microsoft.AspNetCore.App升级到2.1.1版本吗?

还是只是将所有nuget引用升级到最新版本? (为此是2.1.2)

关于在本地工作的构建,请尝试清理或创建源代码控制存储库的新克隆,看看是否可行。

答案 1 :(得分:0)

明确设置版本属性即可解决它,已更改:

<PackageReference Include="Microsoft.AspNetCore.App" />

<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />

此处有更多详细信息:https://github.com/aspnet/Universe/issues/1180#issuecomment-392180608

答案 2 :(得分:0)

我也正在处理这些问题,但这是因为我只是从其他地方复制了部署YAML文件而未使用适当的工具。遵循本教程后,它就像一个魅力:

https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core?view=azure-devops

更具体地说,我认为使用dotnet restore可以还原软件包:

.side {
  right: 1px;
  float: right;
  margin: 0;
  margin-right: 1%;
  width: 26vw;
  height: 80%;
  background-color: #ffffff;
  border-radius: 10px;
  border: 5px solid #EFA078;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  position: fixed;
  padding: 0;
}

.content {
  height: 51%;
  background-color: #ffffff;
}

.pic {
  margin-left: 20px;
  margin-right: 20px;
  max-width: 100%;
}

.sbutt-container {
  position: absolute;
  display: block;
  height: auto;
  bottom: 0;
  width: 100%;
  background-color: white;
  height: auto;
  padding: 10px;
  box-sizing: border-box;
}

.sbutt {
  background-color: #EFA078;
  display: block;
  text-align: center;
  font-size: 10px;
  vertical-align: middle;
  padding: 5px 5px;
}

.cancel {
  width: 30%;
  float: left;
  left: 0;
}

.order {
  width: 50%;
  float: right;
  right: 0;
}

.grid-container {
  display: grid;
  grid-template-columns: auto auto auto;
  grid-column-gap: 1px;
  grid-row-gap: 2px;
  padding: 0;
  width: 69vw;
  height: 100%;
  margin-left: 0.8%;
  float: left;
}

.a {
  margin: 0;
  width: 150px;
  height: 150px;
  background-color: red;
}

确保也安装正确的.NET Core SDK。

steps:
- script: dotnet restore