Azure DevOps VSTS .netcore build failing, but works fine on my PC

azure devops dotnet sdk version
dotnet tool install azure devops
errordotnet command failed with non zero exit code on the following projects
dotnet restore
use dotnet
dotnet core installer 0
please install dotnet core to enable automatic generation of html report
the process c:program filesdotnetdotnet.exe failed with exit code 1

I keep getting dependencies errors in my .net core2.1.1 MVC website. It builds fine from my PC. but Azure DevOps is not compiling refrences properly.

Adding a couple of pics to help sort this out.

DevOps Error. After I added a update nuget to the latest

The nuget command failed with exit code(1) and error(NU1607: Version conflict detected for Microsoft.Extensions.DependencyInjection.Abstractions. Reference the package directly from the project to resolve this issue. CBW.Website (>= 1.0.0) -> Microsoft.VisualStudio.Web.CodeGeneration.Design (>= 2.1.5) -> Microsoft.VisualStudio.Web.CodeGenerators.Mvc (>= 2.1.5) -> Microsoft.VisualStudio.Web.CodeGeneration (>= 2.1.5) -> Microsoft.Extensions.DependencyInjection (>= 2.1.1) -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.1) CBW.Website (>= 1.0.0) -> Microsoft.AspNetCore.App (>= 2.1.0) -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.0). Errors in D:\a\1\s\CBW.Website\CBW.Website.csproj NU1607: Version conflict detected for Microsoft.Extensions.DependencyInjection.Abstractions. Reference the package directly from the project to resolve this issue. CBW.Website (>= 1.0.0) -> Microsoft.VisualStudio.Web.CodeGeneration.Design (>= 2.1.5) -> Microsoft.VisualStudio.Web.CodeGenerators.Mvc (>= 2.1.5) -> Microsoft.VisualStudio.Web.CodeGeneration (>= 2.1.5) -> Microsoft.Extensions.DependencyInjection (>= 2.1.1) -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.1) CBW.Website (>= 1.0.0) -> Microsoft.AspNetCore.App (>= 2.1.0) -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.0).)

Packages failed to restore

***************Edit I passed the nuget errors based on and targeting the everything to version 2.1.5 in my csproj. Now I am back to the restore error.

My Csproj

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
     <RuntimeFrameworkVersion>2.1.5</RuntimeFrameworkVersion>
    <UserSecretsId>aspnet-AspNetCorePagesIdentity-***************-***-*******-</UserSecretsId>
    <TypeScriptToolsVersion>3.0</TypeScriptToolsVersion>
    <AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="Client\assets\controlbyweb-logo.png" />
    <Content Include="Client\assets\webrelay_170.png" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.5" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.5" PrivateAssets="All" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Areas\Identity\Services\" />
  </ItemGroup>

  <ItemGroup>
    <Content Update="Client\_ViewImports.cshtml">
      <Pack>$(IncludeRazorContentInPack)</Pack>
    </Content>
  </ItemGroup>


</Project>

**** error**

2018-10-08T14:44:09.2159846Z   Restoring packages for D:\a\1\s\CBW.Website\CBW.Website.csproj...
2018-10-08T14:44:09.7085782Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error : Package Microsoft.VisualStudio.Web.CodeGeneration.Design 2.1.5 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.VisualStudio.Web.CodeGeneration.Design 2.1.5 supports: [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7094563Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error :   - net461 (.NETFramework,Version=v4.6.1) [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7099570Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error :   - netstandard2.0 (.NETStandard,Version=v2.0) [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7102618Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error : Package Microsoft.AspNet.WebApi.Client 5.2.6 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.AspNet.WebApi.Client 5.2.6 supports: [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7103331Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error :   - net45 (.NETFramework,Version=v4.5) [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7103534Z C:\hostedtoolcache\windows\dncs\1.0.4\x64\sdk\1.0.4\NuGet.targets(97,5): error :   - netstandard2.0 (.NETStandard,Version=v2.0) [D:\a\1\s\CBW.Website\CBW.Website.csproj]
2018-10-08T14:44:09.7103694Z        Package Microsoft.Extensions.WebEncoders 2.1.1 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.Extensions.WebEncoders 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
2018-10-08T14:44:10.0475303Z       Package Microsoft.Net.Http.Headers 2.1.1 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.Net.Http.Headers 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
2018-10-08T14:44:10.0475426Z       Package Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.5 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.5 supports: netstandard2.0 (.NETStandard,Version=v2.0)
2018-10-08T14:44:10.0475562Z       One or more packages are incompatible with .NETCoreApp,Version=v2.1.
2018-10-08T14:44:10.0475666Z   
2018-10-08T14:44:10.0475771Z   NuGet Config files used:
2018-10-08T14:44:10.0475909Z       D:\a\1\Nuget\tempNuGet_13.config
2018-10-08T14:44:10.0476013Z   
2018-10-08T14:44:10.0476113Z   Feeds used:
2018-10-08T14:44:10.0476241Z       https://api.nuget.org/v3/index.json
2018-10-08T14:44:10.1010270Z ##[error]Error: C:\hostedtoolcache\windows\dncs\1.0.4\x64\dotnet.exe failed with return code: 1
2018-10-08T14:44:10.1032411Z ##[error]Packages failed to restore
2018-10-08T14:44:10.1055895Z ##[section]Finishing: Restore

Solved it Edit 7/5/19 The YML file or the editor has the same issue with the .netcore SDK version. I have updated mine multiple times now. It will break randomly when the core SDK team pushes updates to Nuget, or you update VS or sometimes.. My builds are automated and it works today and tomorrow it does not, after 0 code changes. But I always come back to this fix and then it builds again.

Get your SDK version in VS2017

Set your version in DevOps

Azure DevOps VSTS .netcore build failing, but works fine on my PC, I keep getting dependencies errors in my .net core2.1.1 MVC website. It builds fine from my PC. but Azure DevOps is not compiling refrences  Azure Devops Release pipeline not picking Agent.Name property 1 Solution Configure Azure DevOps repo in Azure Data Factory - permissions error

I would suggest checking the following 2 items:

  1. Build in RELEASE locally and see if the problem is reproduced.
  2. Be specific about NuGet version in VSTS:

Azur DevOps netcore restore failing. But works in VS2017 on my , Developer Community for Visual Studio Product family. This works fine on my local PC but fails on the Build sever in azure dev ops. I started with the DevOps sample .netcore project and build pipeline. Then replaced the  Dev and Release build works fine on my pc. Its failing in Azure Devops restore. Azure DevOps restore fails. Azure DevOps VSTS .netcore build failing, but

For those of you configuring through a YAML file: I was dealing with these issues too but it was because I simply copied a deployment YAML file from somewhere else and did not use the proper tooling. After following this tutorial, it worked like a charm:

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

More specifically, I think using the dotnet restore to restore your packages might fix it:

steps:
- script: dotnet restore

Make sure to install the correct .NET Core SDK, too.

steps:
- task: DotNetCoreInstaller@0
  inputs:
    version: '2.1.300' # replace this value with the version that you need for your project

NuGet Restore task fails for .Net Core project migrated with VS 2017 , Net Core project which has been converted with Visual Studio 2017. The build plan especially the task NuGet Restore worked for that one before the ok, the dotnet restore task is working, but it still seems like a bug(for me). Setting up CI in Azure for my Core MVC project and running into this error. I'm working to automate my build Devops Pipelines. My Visual Studio (15.9.7) build succeeds, but when I try the build in Devops Pipelines, I get the error:

Troubleshoot builds and releases, Azure Pipelines | Azure DevOps Server 2019 | TFS 2018 | TFS 2017 | TFS NET Core, see . If your pr trigger isn't firing, and you are using Azure Repos, it is because pr If your pipeline starts but fails to successfully complete, review the logs to By default the build tasks such as MSBuild and Visual Studio Build run  To configure verbose logs for all runs, edit the build, navigate to the Variables tab, and add a variable named system.debug, set its value to true, and select to Allow at Queue Time. View and download logs. To view individual logs for each step, navigate to the build results for the run, and select the job and step.

Building and Deploying Services to Azure with .NET Core and Docker, The concept wasn't new, but the implementation was good and began to take hold. This allowed the containers to be run on any computer. NET Core that runs not only on Windows, but on Macs and Linux and a host of other If the build fails, check your Docker Settings and make sure that the drive you're using for  DevOps DevOps Deliver innovation faster with simple, reliable tools for continuous delivery. Azure DevOps Services for teams to share code, track work and ship software; Azure Pipelines Continuously build, test and deploy to any platform and cloud; Azure Boards Plan, track and discuss work across your teams

How to Configure CI/CD in AzureDevOps, Take advantage of the CI/CD pipeline in Azure DevOps to build, test, and deploy If any of the tests fail, the build process terminates abruptly; The release process is only In this article, you'll be using Visual Studio 2019 and . NET Core installed in your system, you can download a copy from here. Can I update my v2 agents that are part of an Azure DevOps Server pool? Yes. Beginning with Azure DevOps Server 2019, you can configure your server to look for the agent package files on a local disk. This configuration will override the default version that came with the server at the time of its release.

Comments
  • Did you build release on your machine?
  • Try upgrading Microsoft.AspNetCore.App to 2.1.5
  • why not just use dotnet publish to implicitly restore packages, why use nuget direclty as a stage?
  • I added the Nuget based on a GitHub bug I found about dependencies.
  • I built release on my machine to make sure. It works fine
  • This and higher NuGet version, e.g. ASP.NET Core 2.2.105 + Nuget 4.9.4 works
  • I built in release mode before posting and this is exactly how I am calling nuget. except I'm calling 4.3.0, I am trying 4.4.1 now.... And it didn't help