0
votes

Hi I am new to Azure Pipelines

I am trying to build an Xamarin app with a custom Nuget Config but the build fails when I get to the restore command. I get the following error:

The nuget command failed with exit code(1) and error(Failed to retrieve information about 'BCrypt.Net-PCL' from remote source 'http://nuget.uxdivers.com/grial/FindPackagesById()?id='BCrypt.Net-PCL'&semVerLevel=2.0.0'. The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

The package "BCrypt.Net-PCL" is a NuGet package but the restore command is looking for it in the "uxdrivers" source. If I run without a custom NuGet.config the restore can find all NuGet packages but obviously it fails to find the none NuGet sources thus the build fails as well.

I've tried shifting the order of the package sources, the credentials and tried a different vmImage but I always end up with this error. Please excuse my ignorance on this as I am new to YAML & Pipelines.

Thanks in advance for any help!

See below my YAML:

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'config'
    nugetConfigPath: 'NuGet.config'

See below my NuGet.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <clear />
 <packageSources>
  <add key="Grial" value="http://nuget.uxdivers.com/grial"/>
  <add key="Syncfusion_Xamarin" value="https://nuget.syncfusion.com/nuget_xamarin/nuget/getsyncfusionpackages/xamarin"/>
  <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
 </packageSources>
<packageSourceCredentials>
 <Syncfusion_Xamarin>
  <add key="Username" value="*MyUsername*" />
  <add key="Password" value="*MyPassword*" />
 </Syncfusion_Xamarin>
 <Grial>
  <add key="Username" value="*MyUsername*" />
  <add key="Password" value="*MyPassword*" />
 </Grial>
</packageSourceCredentials>
1

1 Answers

1
votes

Azure Pipelines NuGet.config packages failed to restore

It seems the way you configured in the Nuget.Config file have a syntax error.

If there is encrypted password it won't work on a different machine as it's encoded with a key from stored on you dev machine. You could replace it with clear text password, like:

<add key="Username" value="%USER_VARIABLE%" />
<add key="Password" value="%PASSWORD_VARIABLE%" />

Or use the cleartextpassword:

<add key="Username" value="user" />
<add key="ClearTextPassword" value="xxxxxx" />

Check the document nuget.config reference for some more details.

Hope this helps.