OneGet / oneget

PackageManagement (aka OneGet) is a package manager for Windows
MIT License
2.38k stars 190 forks source link

ISE Module Browser requires NuGet-anycpu.exe, but fails to install #166

Open Ma-XX-oN opened 8 years ago

Ma-XX-oN commented 8 years ago

I've tried to install the NuGet-anycpu.exe from the ISE: image

However, when I click on Accept, I get: image

I dunno what's going on, but when I went looking for this, I got this page. Can you please give me a hand?

Thanks,

Maxx

quoctruong commented 8 years ago

Hi Maxx, this may be related to https://github.com/OneGet/oneget/issues/112 where you are installing a very old version of PackageManagement.

mikebuckley commented 8 years ago

Any update on this?

dongchen commented 8 years ago

I just tried to install module browser, and got the same thing. I tried couple of time to install OneGet, but no luck. I saw PackageManagement under program files and under my appdata local folder. Should OneGet be changed to look for PackageManagement? Thank you.

quoctruong commented 8 years ago

Hi all, this seems to be a problem related to the Module Browser and not PackageManagement itself. We will report this to the Module Browser team so they can fix it accordingly. In any case, are you guys able to use PackageManagement on the command line (without using Module Browser)?

dongchen commented 8 years ago

Hello, I can't find-package using the command line tool. For example:

PS C:\Users\dc> Find-Package -Name Firefox Find-Package : No match was found for the specified search criteria and package name 'Firefox'. At line:1 char:1

doctordns commented 8 years ago

Use willd cards:

PSH [C:\foo]: find-package fire

Name Version Source Summary


xFirefox 1.0.0 PSGallery Firefox Main module cFirewall 1.0.1 PSGallery The cFirewall module contains the cFirew cEPRSEnableFirewallInboundC... 1.0 PSGallery cEPRSEnableFirewallInboundConnections Mo

doctordns commented 8 years ago

IN the above post, the fire should have an asterisk before the ford fire and after - the joys of a 'smart' editor

dongchen commented 8 years ago

My issue was that I didn't have package provider chocolatey. Once I have the provider, I can find packages. Module Browser is still not working though.

jphellemons commented 8 years ago

I am running the anniversary update 1607 (build 14393.51) of win 10 and powershell ISE wants to download nuget anycpu and fails. snip_20160816095013 it is rather funny because I use NuGet 3.5.0.x in Visual Studio 2015 on a daily basis snip_20160816095318 chocolatey website says: snip_20160816095453 and links to https://chocolatey.org/docs/features-infrastructure-automation#powershell-packagemanagement

so we just have to wait? is there an ETA/roadmap? Looking forward to oneget in win10!

running Install-PackageProvider -Name NuGet -Force tells me that 2.8.5.206 is installed...

gudenuff commented 7 years ago

I am experiencing the same issue.

Steps to reproduce

Observed behavior

On the Gallery pane you get error messages:

Installing nuget-anycpu.exe

This turns into

Initialization failed. Unable to find package provider 'NuGet'.

Expected result

Switching to Gallery pane should allow searching PowerShell modules out of the box.

Technical data

Available module folders

C:\Program Files\WindowsPowerShell\Modules\PackageManagement
C:\Program Files\WindowsPowerShell\Modules\PowerShellGet
C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1
C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\en
C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\en-US
C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1
C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\en-US

Is KB3134760 installed?

KB3134760 is not installed

Installed providers according to Microsoft.PackageManagement.CoreProviders.dll

Name                                      Version
----                                      -------
ISE                                       1.0.0.0
Microsoft.PackageManagement.CoreProviders 3.0.0.0
Microsoft.PowerShell.Management           3.1.0.0
Microsoft.PowerShell.Security             3.0.0.0
Microsoft.PowerShell.Utility              3.1.0.0
Microsoft.WSMan.Management                3.0.0.0
MMAgent                                   1.0    
PackageManagement                         1.0.0.1
PowerShellGet                             1.0.0.1
Bootstrap

Installed providers according to Get-PackageProvider

Name          Version  
----          -------  
Chocolatey    2.8.5.130
msi           3.0.0.0  
msu           3.0.0.0  
NuGet         2.8.5.207
PowerShellGet 1.0.0.1  
Programs      3.0.0.0 

Current Windows build 14393.187.amd64fre.rs1_release_inmarket.160906-1818

Current PowerShell build* 5.1.14393.187

mobeus1 commented 7 years ago

any resolution to thsi. I am having the exact same issue with the module browser.

edwinbarton commented 7 years ago

Closing on a year later now and still no fix???? I have this same problem on the Anniversary edition of Windows 10 just as some other users have reported. Now that I've discovered this feature it'd sure be nice to actually get to use it!

obensha commented 7 years ago

I managed to get it done with Chocolatey as defined in http://stackoverflow.com/questions/12884282/use-nuget-powershell-commandlets-from-outside-visual-studio so thought to drop this reference here

OzBob commented 7 years ago

@obensha could you explain "get it done"? Did you find a work around that lets you browse and install modules, or did you find a way to fix the 'anycup.exe' error? Thanks.

asdf1nit commented 7 years ago

Same problem here. I have a question for commenters. Do all of you have visual studio installed? packages work fine for me there(VS), but I'm wondering if this is a conflict. I've noticed the people who have this working don't have Visual studio.

dbatchelor commented 7 years ago

I found a solution to this, thought I'd share:

(I'm on Windows 10, and not using Visual Studio ... although I may have had it at one point or have some remnants from .net projects in the past.)

Anyways, I was editing the profile "Microsoft.PowerShellISE_profile.ps1 " and noticed this line:

Add-Type -Path 'C:\Program Files (x86)\Microsoft Module Browser\ModuleBrowser.dll'

The module browser was being loaded from "Program Files (x86)" even though I was pretty sure that i ran some chocolatey updates that installed things into "Program Files"

I commented out that line above, and instead specified the newer path:

Add-Type -Path 'C:\Program Files\WindowsPowerShell\Modules\ISEModuleBrowserAddon\1.0.1.0\ISEModuleBrowserAddon.dll'

Reloaded ISE and the Gallery started working. :)

image

gudenuff commented 7 years ago

@dbatchelor

Finally you've got it nailed! Thanks a bunch!

To enable Module Browser for the 64-bit version of PowerShell ISE:

  1. In Windows Explorer, open
%userprofile%\Documents\WindowsPowerShell
  1. Open PS file for edit, then add the following lines after the commentary header
If ($env:PSModulePath.Split(';') -contains "C:\Program Files\WindowsPowerShell\Modules" -and ([Environment]::Is64BitProcess)) {
    Add-Type -Path 'C:\Program Files\WindowsPowerShell\Modules\ISEModuleBrowserAddon\1.0.1.0\ISEModuleBrowserAddon.dll'
    Write-Host 'Loaded 64-bit version'
    }
else {
    Add-Type -Path 'C:\Program Files (x86)\Microsoft Module Browser\ModuleBrowser.dll'
    Write-Host 'Loaded 32-bit version'
    }
  1. Save changes and start the 64-bit PowerShell ISE.

Whole profile script:

#Module Browser Begin
#Version: 1.0.0
If ($env:PSModulePath.Split(';') -contains "C:\Program Files\WindowsPowerShell\Modules" -and ([Environment]::Is64BitProcess)) {
    Add-Type -Path 'C:\Program Files\WindowsPowerShell\Modules\ISEModuleBrowserAddon\1.0.1.0\ISEModuleBrowserAddon.dll'
    Write-Host 'Loaded 64-bit version of Module Browser'
    }
else {
    Add-Type -Path 'C:\Program Files (x86)\Microsoft Module Browser\ModuleBrowser.dll'
    Write-Host 'Loaded 32-bit version of Module Browser'
    }
$moduleBrowser = $psISE.CurrentPowerShellTab.VerticalAddOnTools.Add('Module Browser', [ModuleBrowser.Views.MainView], $true)
$psISE.CurrentPowerShellTab.VisibleVerticalAddOnTools.SelectedAddOnTool = $moduleBrowser
#Module Browser End

So finally, it works in a 64-bit ISE.

Now there's an issue with the 32-bit version of ISE. For some reason, it loads the 32-bit version of Module Browser for Windows PowerShell ISE (x86), but still it results in the notorious issue with Module Browser being unable to get the NuGet package.

What could be wrong?

OzBob commented 7 years ago

@dbatchelor, @gudenuff . "what could go wrong?" well....

  1. My Path doesn't match on first 'if' C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ is in my $env:PSModulePath, note the v1.0!

So others beware of using the script. May as well hand code it.

Do you have "C:\Program Files\WindowsPowerShell\Modules\ISEModuleBrowserAddon" on your system?

Then edit the "#Module Browser Begin" section of

%userprofile%\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1

to be:

#Module Browser Begin #Version: 1.0.0 Add-Type -Path 'C:\Program Files\WindowsPowerShell\Modules\ISEModuleBrowserAddon\1.0.1.0\ISEModuleBrowserAddon.dll' Write-Host 'Loaded 64-bit version of Module Browser' $moduleBrowser = $psISE.CurrentPowerShellTab.VerticalAddOnTools.Add('Module Browser', [ModuleBrowser.Views.MainView], $true) $psISE.CurrentPowerShellTab.VisibleVerticalAddOnTools.SelectedAddOnTool = $moduleBrowser #Module Browser End

[Edited: added ending bracket, thanks @Damperen]

cciolli commented 7 years ago

@gudenuff So I modified the ...profile.ps1 as suggested. Everything seems to be good with the world...until I open a File > New Powershell Tab (Ctrl+T). Powershell proceeds to tell me that it has loaded the 32-bit version of Module Browser.

After a little detective work I find that as Powershell starts, $env:PSModulePath does not have a trailing backslash on any of the path entries. After it starts, all entries in $env:PSModulePath have trailing backslashes.

I don't know if it's just me but you can test it yourself by adding

Write-Host $env:PSModulePath

just before the If statement. Once Powershell starts, take a look at $env:PSModulePath.

Anyone else seeing this?

Damperen commented 7 years ago

@OzBob This worked for me, however you missed the parenthesis ')' after $true On the following line $moduleBrowser = $psISE.CurrentPowerShellTab.VerticalAddOnTools.Add('Module Browser', [ModuleBrowser.Views.MainView], $true

sampSCS commented 7 years ago

@gudenuff

For my installation, instead of: Add-Type -Path 'C:\Program Files\WindowsPowerShell\Modules\ISEModuleBrowserAddon\1.0.1.0\ISEModuleBrowserAddon.dll'

I had to use: Add-Type -Path 'C:\Users\USERNAME\Documents\WindowsPowerShell\Modules\ISEModuleBrowserAddon\1.0.1.0\ISEModuleBrowserAddon.dll''

before it worked for me

OzBob commented 7 years ago

@gudenuff I think you may have installed WindowsPowerShell in a un-conventional manner, or may not be Admin on your PC??? but congratulations on solving it, it's annoying isn't it!

wastek commented 6 years ago

I initially did not had the ISEModuleBrowser folder in my Program Files at all, even if I installed if from MS download page: https://www.microsoft.com/en-us/download/details.aspx?id=45885

Therefore launching this command installed it correctly: Install-Module -Name ISEModuleBrowserAddon

After that the code provided by @OzBob worked perfectly, thanks !!

TertiusR commented 5 years ago

This still hasn't been fixed? Btw, if you download and install it from MS (one to have to import-module ISEModuleBrowser Every. Damn. Time you open ISE) the setup program will blow away the above customizations putting you back to square one again.

narinderparmar commented 3 years ago

found a simple solution that worked for me

close ISE go to %userprofile%\Documents\WindowsPowerShell rename(/remove) Microsoft.PowerShellISE_profile.ps1
reopen ISE.

doctordns commented 3 years ago

That suggests that the issue is due to something in that ISE Profile. If you have not actually deleted it, you might care to look at what is in that profile as it is the cause of your issue.

pbahr commented 3 years ago

Although the fix by @gudenuff seemed working for me, (I was seeing the prompt Loaded 64-bit version of Module Browser), ISE window would close right away.

The fix was to comment the last two lines of the Microsoft.PowerShellISE_profile:

$moduleBrowser = $psISE.CurrentPowerShellTab.VerticalAddOnTools.Add('Module Browser', [ModuleBrowser.Views.MainView], $true)

$psISE.CurrentPowerShellTab.VisibleVerticalAddOnTools.SelectedAddOnTool = $moduleBrowser

Module Browser End

TyThompson commented 3 years ago

found a simple solution that worked for me

close ISE go to %userprofile%\Documents\WindowsPowerShell rename(/remove) Microsoft.PowerShellISE_profile.ps1 reopen ISE.

Thanks @narinderparmar this fixed my issue