Open matt-richardson opened 7 years ago
Turns out adding a Install-PackageProvider nuget -force
makes it work.
Keeping it open as it the exception message should be improved for this scenario.
@matt-richardson The above mentioned error message is returned by the PowerShell runtime. This is an expected error in non-interactive mode when you don't have the pre-requisites installed like NuGet provider and/or NuGet.exe. Please update the Expected Behavior with expected message you would like to get in this scenario.
Can you tell me why -force
is available locally, but not on the build agent?
I've updated the Expected Behaviour, but not sure its a great idea to get someone who knows very little about how this all works together to design the error messages.
Thanks @matt-Richardson ! Your build agent might be having the PowerShellGet module from previous releases. Please work with your 'Team City' team to have the latest version of PowerShellGet module from the PowerShell Gallery. Get the latest version from PowerShell Gallery
Both my local packages and the ones on the build agents have version 1.0.0.1
. One has the -force
parameter, and one doesn't. Are there multiple different versions out there with the same version number?
Inbox version of PowerShellGet module is 1.0.0.1 in WMF 5.0/5.1, Windows 10 and Windows Server 2016 releases. Version of inbox release is not changed to ensure that Windows Servicing/Updates work fine. In future, we would like resolve this versioning issue for inbox release.
@matt-richardson - There were alot of changes made between the initial 1.0.0.1 version of PowerShellGet that was released in the Windows 10 RTM (& WMF 5) and the 1.0.0.1 version of PowerShellGet that was in the Anniversary Edition of Windows 10 (which has WMF 5.1). One of the many changes was to include the -Force parameter.
Even though I noticed this and brought it up via the MVP distribution list and had the conversation about why this was unacceptable it still happened.
Also From the screenshot above It looks like you've been running this in the x86 PowerShell shell - Can you re-run from the x64 shell at all?
If not then I have a small script that I can dig out for you that you could use to will download and install a later Version of PowerShellGet (or any other module) from the PowerShell Gallery that doesn't use the PowerShellGet Module at all.
Let me know if that would be of any help at all and I'll dig it out for you.
Thanks for the detailed response, @kilasuit. Shame that it happened that way. I've managed to get it all working now, so dont need that script - thanks.
Any particular reason this has been closed? I hit it again the other day.
Sorry, just trying to organize some of the older issues should be re-opened now...
@matt-richardson are you still using version 1.0.0.1 of PowershellGet and PackageManagement?
Do not forget to perform Install-PackageManager "NuGet"
on the correct version of PowerShell (x86 vs x64)! Just took me more than an hour to find out I installed it on the wrong instance.
If spent the last few days banging my head against the wall, trying to get
Publish-Module
to work from under a TeamCity build. I've installed WMF5, downloaded nuget toC:\ProgramData\Microsoft\Windows\PowerShell\PowerShellGet\NuGet.exe
, but still getting an error:I'm using version 1.0.0.1 of PowershellGet and PackageManagement.
Oddly enough, on my local machine, running the same commands gives me version 1.0.0.1 of both packages, but there is an additional
-Force
parameter available. No idea why there are different arguments for the same versions. My local machine has PS 5.1, but the build agent has 5.0Somehow, I managed to get one successful publish out of it, but it didn't work on other build agents. No idea why.
Expected Behavior
I expect it to publish the package. Or, failing that, tell me whats wrong and how to fix it.
If running in non-interactive mode, and nuget is not available, it should fail with a message along the lines of "The nuget package provider is not available. Please run
Install-PackageProvider nuget
.".Once we've figured out why
-force
is available on some machines and not on others, the message could possibly be something like "The nuget package provider is not available. Please re-run the command with the-Force
parameter to install the provider automatically, or install it separately viaInstall-PackageProvider nuget
.".Current Behavior
It fails with the exception
Exception calling "ShouldContinue" with "2" argument(s): "Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available."
Possible Solution
Steps to Reproduce (for bugs)
Context
Your Environment