The following task fails in my Azure Devops pipeline.
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'WinFormsCoreMain\NuGet.Config'
with errors like
"D:\a\1\s\MySnap.Main.sln" (Restore target) (1) ->
"D:\a\1\s\SBD.Core.MySnap.UI\SBD.Core.MySnap.UI.csproj" (_GenerateRestoreGraphProjectEntry target) (6:6) ->
C:\Program Files\dotnet\sdk\7.0.200\NuGet.targets(679,5): error : NuGet.Config is not valid XML. Path: 'D:\a\1\Nuget\tempNuGet_6479.config'. [D:\a\1\s\SBD.Core.MySnap.UI\SBD.Core.MySnap.UI.csproj]
C:\Program Files\dotnet\sdk\7.0.200\NuGet.targets(679,5): error : The '@' character, hexadecimal value 0x40, cannot be included in a name. Line 8, position 46. [D:\a\1\s\SBD.Core.MySnap.UI\SBD.Core.MySnap.UI.csproj]
WinFormsCoreMain\NuGet.Config exists
The pipeline so far is
trigger:
- master
pool:
vmImage: 'windows-2022'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
Major: '2'
Minor: '0'
Patch: '0'
steps:
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=4.3.0'
checkLatest: false
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'WinFormsCoreMain\NuGet.Config'
I upgraded to using DotNetCoreCli@2 after my old pipeline recently stopped working.
I also upgraded my projects to being either .net7 or framework4.8 figuring the only way out is forward.
[Update]
Investigating advice at help.
The issue can be fixed using the new NugetAuthenticate task.
So how do I format the service connection credentials?
I guess I use information from within my Nuget Package Manager -> Packages Sources ?
I tried adding a name
Now I am checking the help
I have updated the steps as follows but there is no improvement
steps:
- task: NuGetAuthenticate@1
inputs:
forceReinstallCredentialProvider: true
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=5.2'
checkLatest: false
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'WinFormsCoreMain\NuGet.Config'
[Update]
NuGet.Config looks like this ( with obfuscations)
Checking DevExpress advice.
[Update[
I tried commenting out the "SBDCommonFeed@Local" packageSource and the restore task was able to run.
SBDCommonFeed is the name of a feed in my artifacts. Why do I need to comment it out to avoid this particular error?