I'm using Azure Dev Ops to work with my ASP.NET Core web application. I'm setting up a pipeline but I'm getting errors. The errors are coming from a package restore issue since my application uses the KendoUI library I have to create a service connection for the private NuGet packages that are required. Having done that, the build still fails and I was wondering what is going wrong?
Error Message
[error]The nuget command failed with exit code(1) and error(NU1102: Unable to find package Telerik.UI.for.AspNet.Core with version (>=
2019.2.619) - Found 1 version(s) in NuGetOrg [ Nearest version: 2016.3.914 ] Errors in d:\a\1\s\MyCompany\MyProject.UI.csproj NU1102: Unable to find package Telerik.UI.for.AspNet.Core with version (>= 2019.2.619) - Found 1 version(s) in NuGetOrg [ Nearest version: 2016.3.914 ])
[error]Packages failed to restore
I spoke with Telerik support who said the above code is because there is a failure in authentication and that causes the system to look for an older version which is causing this compatibility issue. I was asked to check my authentication which I have, yet this error persists.
I followed the documentation from Telerik on how to achieve this which you can find here: https://www.telerik.com/blogs/azure-devops-and-telerik-nuget-packages
Ok, to start off, my project has a nuget.config
file located in its root directory. The contents of the file are:
nuget.config
<?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" />
</packageSources>
<packageSourceCredentials>
<Telerik>
<add key="Username" value="[email protected]" />
<add key="ClearTextPassword" value="MyFunkYPassword19!" />
</Telerik>
</packageSourceCredentials>
</configuration>
Within Azure Dev Ops, I have created a service connection in the manner described in their documentation which has the name username and password as the above code
In my pipeline, I have added the Nuget package which is set to restore using my service connection above.
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# 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'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- 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)'
The settings for the above pipeline step are as follows:
Does anyone have any ideas what's going on, is my setup incorrect?