I'm running a CD/CI Pipeline in Azure DevOps and recently my pipeline jobs have begun to fail with the following errors:
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
##[warning]Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x (3.0 and 3.1) SDK/Runtime along with 2.1.
Unless you have locked down a SDK version for your project(s), 3.x SDK
might be picked up which might have breaking behavior as compared to
previous versions.
Some commonly encountered changes are:
If you're using `Publish` command with -o or --Output argument, you will see that the output folder is now being created at root
directory rather than Project File's directory. To learn about more
such changes and troubleshoot, refer here:
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[error]Dotnet command failed with non-zero exit code on the following projects : D:\a\1\s\MyProject\MyProject.UI.csproj
As well as the above, there are errors pertaining to the location of resources:
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : warning NU1603: System.Memory 4.5.1 depends on System.Buffers (>= 4.4.0) but System.Buffers 4.4.0 was not found. An approximate best match of System.Buffers 4.5.0 was resolved. [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : warning NU1603: System.Memory 4.5.1 depends on System.Buffers (>= 4.4.0) but System.Buffers 4.4.0 was not found. An approximate best match of System.Buffers 4.5.0 was resolved. [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : warning NU1603: System.Net.WebSockets.WebSocketProtocol 4.5.1 depends on System.Buffers (>= 4.4.0) but System.Buffers 4.4.0 was not found. An approximate best match of System.Buffers 4.5.0 was resolved. [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : warning NU1603: System.Net.WebSockets.WebSocketProtocol 4.5.1 depends on System.Buffers (>= 4.4.0) but System.Buffers 4.4.0 was not found. An approximate best match of System.Buffers 4.5.0 was resolved. [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : warning NU1603: System.Memory 4.5.1 depends on System.Numerics.Vectors (>= 4.4.0) but System.Numerics.Vectors 4.4.0 was not found. An approximate best match of System.Numerics.Vectors 4.5.0 was resolved. [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : warning NU1603: System.Net.WebSockets.WebSocketProtocol 4.5.1 depends on System.Numerics.Vectors (>= 4.4.0) but System.Numerics.Vectors 4.4.0 was not found. An approximate best match of System.Numerics.Vectors 4.5.0 was resolved. [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : warning NU1603: System.Memory 4.5.1 depends on System.Numerics.Vectors (>= 4.4.0) but System.Numerics.Vectors 4.4.0 was not found. An approximate best match of System.Numerics.Vectors 4.5.0 was resolved. [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : warning NU1603: System.Threading.Channels 4.5.0 depends on System.Threading.Tasks.Extensions (>= 4.5.0) but System.Threading.Tasks.Extensions 4.5.0 was not found. An approximate best match of System.Threading.Tasks.Extensions 4.5.1 was resolved. [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : warning NU1603: System.Net.WebSockets.WebSocketProtocol 4.5.1 depends on System.Numerics.Vectors (>= 4.4.0) but System.Numerics.Vectors 4.4.0 was not found. An approximate best match of System.Numerics.Vectors 4.5.0 was resolved. [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : warning NU1603: System.Threading.Channels 4.5.0 depends on System.Threading.Tasks.Extensions (>= 4.5.0) but System.Threading.Tasks.Extensions 4.5.0 was not found. An approximate best match of System.Threading.Tasks.Extensions 4.5.1 was resolved. [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : error NU1101: Unable to find package Azure.Storage.Blobs. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : error NU1101: Unable to find package Microsoft.Azure.KeyVault.Core. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : error NU1101: Unable to find package WindowsAzure.Storage. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Hosting. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Mvc.Core. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : error NU1101: Unable to find package Microsoft.EntityFrameworkCore.SqlServer. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.SignalR.Client. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Services\MyProject.Services.csproj : error NU1101: Unable to find package SixLabors.ImageSharp. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.SignalR.Client. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : error NU1101: Unable to find package Microsoft.EntityFrameworkCore.SqlServer. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : error NU1101: Unable to find package Microsoft.EntityFrameworkCore.Tools. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : error NU1101: Unable to find package SixLabors.ImageSharp. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Hosting. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Mvc.Core. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj : error NU1101: Unable to find package WindowsAzure.Storage. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages [D:\a\1\s\MyProject\MyProject.UI.csproj]
Restore failed in 3.8 sec for D:\a\1\s\MyProject.Repo\MyProject.Repo.csproj.
Restore failed in 3.8 sec for D:\a\1\s\MyProject.Services\MyProject.Services.csproj.
Restore completed in 1.07 min for D:\a\1\s\MyProject.Data\MyProject.Data.csproj.
Restore completed in 1.13 min for D:\a\1\s\MyProject\MyProject.UI.csproj.
What I'm noticing here is that it's looking in Microsoft Visual Studio Offline Packages
for these packages and I'm not sure why or if that's acceptable or not. Locally the solution builds fine, it's only once we are trying to build on the pipeline that these errors occur. Researching the error brought around a couple of options but none have worked.
My application is using .NET Core 3.1.101
and is fully up to date. I have three packages sources defined, NuGet
, Microsoft Visual Studio Offline
, and Telerik
.
Here is my nuget.config
file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSources>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="Telerik" value="https://nuget.telerik.com/nuget" />
<add key="MyGet" value="https://www.myget.org/F/sixlabors/api/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<Telerik>
<add key="Username" value="xxx" />
<add key="ClearTextPassword" value="xxx" />
</Telerik>
</packageSourceCredentials>
</configuration>
My pipeline, which I built a little while ago now and the one area that could be responsible for problems, looks like this, I'm happy to take feedback on this:
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
dotnetSdkVersion: '3.1.101'
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: true
arguments: '--configuration $(buildConfiguration) --output $(Build.artifactStagingDirectory)'
zipAfterPublish: true
# Build and test ASP.NET Core projects targeting the full .NET Framework.
- task: UseNode@1
- task: PublishBuildArtifacts@1
displayName: 'publish artifacts'
- task: NuGetToolInstaller@1
# Restore #
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'config'
nugetConfigPath: 'MyProject/nuget.config'
externalFeedCredentials: 'Telerik NuGet'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
So, a frustrating problem that I can't pin down, hopefully, someone can help me get to the bottom of it.
Update
Just to add some additional context to my question, my solution is separated into MyProject.Repo
, MyProject.Services
, MyProject.Data
and MyProject.UI
.
In terms of the target framework for these, they are as follows:
The build fails on the job DotNetCoreCLI
To configure verbose logs for a single run, you can start a new build by choosing Run pipeline and selecting Enable system diagnostics, Run. To configure verbose logs for all runs, you can add a variable named system. debug and set its value to true .
To authorize any pipeline to use the service connection, go to Azure Pipelines, open the Settings page, select Service connections, and enable the setting Allow all pipelines to use this connection option for the connection.
error NU1101: Unable to find package Microsoft.AspNetCore.Mvc.Core. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages.
According to the error message, the package couldn’t be found in Private Nuget resource. These packages exist in nuget.org.
For this, you can try to add a “dotnet restore” task before “dotnet publish” task. Then you could reference the nuget.config file in the task.
For example:
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '**/*.csproj'
feedsToUse: config
nugetConfigPath: 'nuget.config'
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With