question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nuget source credentials management

See original GitHub issue

Hello, We are preparing the introduction of Paket for managing package references in our company for our main product codebase. The packages for this codebase are stored in an Artifactory repository with no anonymous access. Developers need to use their LDAP company credentials to access it, the build agents are using a build account. A developer’s password changes every 3 months, the build account password never changes.

We would like to use the command paket.exe config add-credentials to solve this problem. It works fine to restore packages once the credentials are stored. But when using this solution, we also need to catch up the moment where the stored credentials need to change properly. We handle calling paket.bootstrapper.exe and paket.exe from a bootstrap.bat file in the root of our codebase. I wanted to programmatically detect when paket was failing to restore packages because of credentials.

Unfortunately, neither paket.bootstrapper.exe or paket.exe are returning a proper exit code different than 0 when there is a critical error:

  • paket.bootstrapper.exe is ordered to force download from Nuget, from a Nuget feed that does not exist, it returns exit code 0 (I tried to simulate a situation where the dev cannot access internet)
  • paket.exe is ordered to restore packages and the nuget source credentials are incorrect, it returns 0

The simple batch script I wrote to test that, meant to be executed from the root folder of the codebase:

@ECHO off

echo Downloading latest paket.exe with paket.boostrapper.exe

call "%~dp0\.paket\paket.bootstrapper.exe" --force-nuget --nuget-source=https://artifacts.sonova.com/artifactory/api/nuget/chinook-production

echo Exit Code for paket.bootstrapper.exe is %errorlevel%

if errorlevel 1 (

    if exist "%~dp0\.paket\paket.exe" (

        echo paket.bootstrapper.exe failed, but current paket.exe is present and can be used

    ) else (
        echo paket.bootstrapper.exe failed, and there is no existing paket.exe file.

        echo Package restoration process cannot continue

        pause

        exit /b 1
    )
)

echo.

echo Restoring packages with paket.exe

call "%~dp0\.paket\paket.exe" restore

echo Exit Code for paket.exe restore is %errorlevel%

if errorlevel 1 (
   echo paket.exe failed to restore packages

   exit /b %errorlevel%
)

pause

@ECHO on

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Treitcommented, Mar 16, 2017

How does one delete stored credentials? I was trying to troubleshoot an issue where paket cannot connect to one of our package feeds and it is now stuck failing (every time) with Credentials from authentication store for <myUrl> are invalid…and now I have no idea how to get rid of the stored credentials.

Edit: Nevermind, found it: del /q %appdata%\paket\*

0reactions
Vilmircommented, Jan 14, 2016

Thanks Steffen, indeed now paket.exe returns 1 when credentials are outdated!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authenticating feeds with nuget.exe credential providers
Globally: to make a credential provider available to all instances of nuget.exe run under the current user's profile, add it to %LocalAppData%\ ...
Read more >
Consuming packages from authenticated feeds
For the various NuGet clients, the private feed provider itself is responsible for authentication. All NuGet clients have extensibility ...
Read more >
CredentialManagement 1.0.2
Credential Management package is a wrapper for the Windows Credential Management API that supports both the old and the new style of UI....
Read more >
NuGet.Credentials 6.7.0
NuGet client's authentication models. ... NET CLI; Package Manager; PackageReference; Paket CLI; Script & Interactive; Cake. dotnet add package NuGet.
Read more >
Adding a NuGet Package Source that requires credentials ...
I figured out that you need to download nuget.exe to your computer, open up a command prompt and navigate to it. Then run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found