appveyor nuget feed from a powershell script before build -- Error Message: missing 'Credential' parameter in the cmdlet

joel.mccune's Avatar

joel.mccune

25 Aug, 2017 03:23 PM

Hi

Before build we call a powershell script with the command Find-Package [-Id].
We then get the error: Cannot access 'https://ci.appveyor.com/nuget/[name]'. Are you missing 'Credential' parameter in the cmdlet?

nuget:
  account_feed: true
before_build:
- ps: C:\ciscripts\our-script-with-the-command.ps1
- cmd: nuget restore

If we use nuget sources add -name <markdown-scanner-project-name> -source <markdown-scanner-project-feed-url> we get an error message that: nuget : The source specified has already been added to the list of available package sources. Please provide a unique source.

Question: How to access our appveyor nuget feed from a powershell script, before build?

Thanks

  1. Support Staff 1 Posted by Feodor Fitsner on 25 Aug, 2017 03:27 PM

    Feodor Fitsner's Avatar

    Hi Joel,

    Could you drop a link to a build please?

  2. 2 Posted by joel.mccune on 25 Aug, 2017 03:31 PM

    joel.mccune's Avatar
  3. 3 Posted by joel.mccune on 25 Aug, 2017 05:15 PM

    joel.mccune's Avatar

    Hi Feodor,

    This is the big picture for what we are trying to do.
    We want to know the latest version of a Nuget Package.

    Build Reference: https://ci.appveyor.com/project/NTEUCI/intranet-datatoexcel/build/1...

    Thanks

  4. Support Staff 4 Posted by Feodor Fitsner on 25 Aug, 2017 08:21 PM

    Feodor Fitsner's Avatar

    It's possible that Find-Package cmdlet is not using credentials from nuget.config file AppVeyor updates with a custom feed.

    One way to solve that would be extracting credentials from nuegt.config with PowerShell and then passing them to Find-Package cmdlet in Credential parameter.

    However, a simple approach could be using nuget command, something like:

    $packageIdVer = (nuget list <package-id> -source AppVeyorAccountFeed)
    

    It should return a string <id> <version>, so you can additionally split it and check second part.

    Let me know if that helps.

  5. 5 Posted by joel.mccune on 28 Aug, 2017 05:49 PM

    joel.mccune's Avatar

    Thanks your insight was helpful.
    This is our final result:

    nuget list <package-id> -source AppVeyorAccountFeed
    
    Which returned: Using credentials from config. UserName: nuget <package-id> <version>
  6. joel.mccune closed this discussion on 28 Aug, 2017 05:49 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac