Azure Pipelines NuGet.config packages failed to restore - nuget

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.
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>

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.

Related

aspnet_regiis saying success but connectionString section unchanged

So I have a web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<connectionStrings>
<clear />
<add name="AS400" providerName="System.Data.ProviderName" connectionString="DataSource=REDACTED; UserID=REDACTED; Password=REDACTED; InitialCatalog=REDACTED; DataCompression=True; CheckConnectionOnOpen=True; CharBitDataAsString=True; Naming = System" />
</connectionStrings>
...
And I'm trying to figure out how to encrypt the connectionStrings section, following this documentation.
I navigated to the location of the published web app and ran the following command as an admin: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -pe "connectionStrings" -app / -prov "RsaProtectedConfigurationProvider"
The command output the following:
Microsoft (R) ASP.NET RegIIS version 4.0.30319.0
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation. All rights reserved.
Encrypting configuration section...
Succeeded!
...But it didn't seem to do anything! The web.config is unchanged.
I'm probably missing something obvious here but I've never used aspnet_regiis before so I have no idea how to proceed.
I got it. Running it with an app of \ in the correct location isn't good enough. (Likewise, for some reason, navigating to just C:\Windows\Microsoft.NET\Framework64\v4.0.30319 then running aspnet_regiis doesn't work). Need to fully-qualify both paths:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -pef "connectionStrings" "C:\Atlassian\bamboo-home\xml-data\build-dir\4587526-3997713"

NuGet Push Error 500 (without Proxy), Error 503 (with Proxy)

I try to Push a nupkg to a Artifacts in a Azure DevOps Server.
The network is behind a proxy so my C:\Users\user\AppData\Roaming\NuGet\NuGet.Config looks like:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="FrameworkA" value="http://xfc-l-s6fc5086:8070/Samples/_packaging/FrameworkA/nuget/v3/index.json" />
</packageSources>
<config>
<add key="http_proxy" value="http://my-proxy:8000" />
<add key="http_proxy.user" value="domain\user" />
<add key="http_proxy.password" value="*** windows security key ***" />
</config>
</configuration>
From my feed (Azure DevOps) page I get the following information:
so if I execute:
nuget.exe push -Source "FrameworkA" -ApiKey AzureDevOps .\FrameworkA.1.0.0.nupkg
I get:
The response status code does not indicate success: 503 (Service Unavailable).
I remove the proxy information from my nuget.config and I get:
The response status code is unsuccessful: 500 (Internal Server Error - Error retrieving data from the upstream packet source https://api.nuget.org/v3/index.json): Error sending the request. (DevOps activity ID: 69FB4414-ED0B-4367-B121-B0DC9B366367)).
And I also get this meaasge when I remove the entry:
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
Whats going wrong here? Has anybody experience with Azure DevOps Server behind a proxy? (everything else with azure devops server works fine, REST API, Custom Extension, Build- and release tasks and so on)
Version: 17.143.28912.1 (AzureDevOps2019.0.1)
I got the same and solved it because of a typo. If I add the DevOps as Proxy it works.
<add key="http_proxy" value="http://devops.yourdomain:8080" />
That worked im my case. IDK why!

dotnet nuget push with user credentials

I am trying to push package from Linux via dotnet-cli.
I have my own nuget server - via package https://www.nuget.org/packages/NuGet.Server/
Using following command:
dotnet nuget push mypackage.nupkg
I have XML config with package source:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<config>
<add key="DefaultPushSource" value="https://mynuget.azurewebsites.net/api/v2/package" />
</config>
<packageSources>
<add key="MyNuget" value="https://mynuget.azurewebsites.net/api/v2/package" />
</packageSources>
<packageSourceCredentials>
<MyNuget>
<add key="Username" value="user" />
<add key="ClearTextPassword" value="pass" />
</MyNuget>
</packageSourceCredentials>
<apikeys>
<add key="https://mynuget.azurewebsites.net/" value="AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAV4A39UQG0kyF2wMV56X9wQAAAAACAAAAAAAQZgAAAAEAACAAAAABPigYqsJ8B9Vcs2e6SXGUKbqctjmrNyoUQz/6H7FSWwAAAAAOgAAAAAIAACAAAAAhm/tVYS41jbvn9NIL6IPHFSFDpBDL/fbBXzdTBSRvWRAAAACY41RYMpAJoSeSdq5paZCvQAAAADZRmyl+f4XYYnPpi1Ia9Kf0TsM6ddNXUL2sJIWXtQ6zNOliZ1IGlpU62c83v93siZp7GCRjj9fIoG6ixbK2Rxg=" />
</apikeys>
</configuration>
Error message which I am getting is:
warn : No API Key was provided and no API Key could be found for 'https://mynuget.azurewebsites.net/api/v2/package'.
To save an API Key for a source use the 'setApiKey' command.
info : Pushing mypackage.nupkg to 'https://mynuget.azurewebsites.net/api/v2/package'...
info : PUT https://mynuget.azurewebsites.net/api/v2/package/
info : Forbidden https://mynuget.azurewebsites.net/api/v2/package/ 3898ms
It seems that nuget.config is completely ignored by dotnet-cli?
I also cannot pass --config-file parameter - getting error error: Unrecognized option '--config-file' but it should be possible as per documentation:
https://github.com/dotnet/docs/blob/master/docs/core/tools/dotnet-nuget-push.md
I managed to get it to work by just putting my nuget.config in the same folder as the .nupkg file and running dotnet nuget push from that folder.
It seems the issue is described here:
https://github.com/NuGet/Home/issues/4879 and it's still in the Open status.
It also looks like someone already created a fix: https://github.com/automotiveMastermind/condo/issues/50.

How do you enable logging for CrmServiceClient in the Xrm Tooling toolkit?

I'm having issues trying to log in to a CRM Online organization through the use of the latest version of the Xrm Tooling nuget package using the connection string constructor from a custom powershell cmdlet.
I'm receiving a rather unhelpful "Unable to Login to Dynamics CRM" error message and am attempting to enable tracing to troubleshoot but have not been able to enable it by modifying the .dll.config file like the below (taken from an XrmToolbox issue on GitHub):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="Microsoft.Xrm.Tooling.Connector.CrmServiceClient"
switchName="Microsoft.Xrm.Tooling.Connector.CrmServiceClient"
switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="console" type="System.Diagnostics.DefaultTraceListener" />
<remove name="Default" />
<add name ="fileListener" />
</listeners>
</source>
<source name="Microsoft.Xrm.Tooling.CrmConnectControl"
switchName="Microsoft.Xrm.Tooling.CrmConnectControl"
switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="console" type="System.Diagnostics.DefaultTraceListener" />
<remove name="Default" />
<add name ="fileListener" />
</listeners>
</source>
</sources>
<switches>
<!--
Possible values for switches: Off, Error, Warning, Info, Verbose
Verbose: includes Error, Warning, Info, Trace levels
Info: includes Error, Warning, Info levels
Warning: includes Error, Warning levels
Error: includes Error level
-->
<add name="Microsoft.Xrm.Tooling.Connector.CrmServiceClient" value="Verbose" />
<add name="Microsoft.Xrm.Tooling.CrmConnectControl" value="Verbose" />
<add name="Microsoft.Xrm.Tooling.WebResourceUtility" value="Verbose" />
</switches>
<sharedListeners>
<add name="fileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="XRMToolingLogs.log" />
<!--<add name="eventLogListener" type="System.Diagnostics.EventLogTraceListener" initializeData="XRMTooling" />-->
</sharedListeners>
</system.diagnostics>
</configuration>
I was able to work around this by configuring the listener programmatically through:
Microsoft.Xrm.Tooling.Connector.TraceControlSettings.TraceLevel = System.Diagnostics.SourceLevels.All;
Microsoft.Xrm.Tooling.Connector.TraceControlSettings.AddTraceListener(new TextWriterTraceListener("log.txt"));
Which pointed me to the actual error which was that the CrmServiceClient was expecting a URL with the organization unique name instead of the URL name.

How to configure SymbolSource Server Basic

I have SymbolSource Server Basic installed and running, following the instructions in Xavier Decosters blog entry.
I have set up Visual Studio as recommended by SymbolSource
The problem is that the Symbol Server returns 404's for all the url's that Visual Studio asks for.
Visual Studio accesses the following urls when trying to load the pdb:
http.../WinDbg/pdb/MightyLittleGeodesy.pdb/82A03D09EC754F5893C3806CDA329EC92/MightyLittleGeodesy.pdb
http.../WinDbg/pdb/MightyLittleGeodesy.pdb/82A03D09EC754F5893C3806CDA329EC92/MightyLittleGeodesy.pd_
http.../WinDbg/pdb/MightyLittleGeodesy.pdb/82A03D09EC754F5893C3806CDA329EC92/file.ptr
The SymbolServer website has the following:
\...\Data\MightyLittleGeodesy\1.0.0.0\Binaries\MightyLittleGeodesy\82A03D09EC754F5893C3806CDA329EC92\MightyLittleGeodesy.pdb
I have tried a large number of url variations in a browser, and I cannot get the Symbol server to return anything other than a 404 for any of them.
Does anyone know what to do here?
Thanks - Cedd
For any errors refer http://localhost/%your_app%/elmah.axd
If you faced with 404.* errors then you should check the following conditions:
Add write permissions onto 'Data' directory of application for IIS_IUSRS group
Create separate AppPool for application and enable 32bit option
Add MIME types for both .pdb (application/octet-stream) and .cs (text/plain) file types
Edit web.config and add the following lines:
<location path="Data">
<system.webServer>
<handlers>
<clear />
<add name="Deny" verb="*" path="*.config" type="System.Web.HttpForbiddenHandler" />
<add name="Allow" verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler" />
</handlers>
<security>
<requestFiltering>
<fileExtensions allowUnlisted="true">
<clear />
<add fileExtension=".cs" allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
<location path="WinDbg/pdbsrc">
<system.webServer>
<handlers>
<clear />
<add name="Deny" verb="*" path="*.config" type="System.Web.HttpForbiddenHandler" />
<add name="Allow" verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler" />
</handlers>
<security>
<requestFiltering>
<fileExtensions allowUnlisted="true">
<clear />
<add fileExtension=".cs" allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
My version of SymbolSource is 1.3.3