NuGet and Chocolatey in powershell and I don’t want them.

Welcome Forums General PowerShell Q&A NuGet and Chocolatey in powershell and I don’t want them.

Viewing 4 reply threads
  • Author
    Posts
    • #234589
      Participant
      Topics: 1
      Replies: 2
      Points: 20
      Rank: Member

      I don’t remember exactly when I did it, but I have NuGet in my powershell and when I try to Install-Package it searches for Chocolatey as a provider. I don’t know if it’s a NuGet thing or a chocolatey thing, but I simply can’t install any packages. Nor can I remove them from my powershell, when I disable powershell as a feature on my computer it does not uninstall powershell like it’s supposed to so I’m stuck with this nonfunctional version of it. Whenever I try to install a package, this happens:
      WARNING: NuGet: System.InvalidOperationException: Unable to find version '' of package ''.
      WARNING: NuGet: at NuGet.PackageRepositoryHelper.ResolvePackage(IPackageRepository sourceRepository,
      IPackageRepository localRepository, IPackageConstraintProvider constraintProvider, String packageId, SemanticVersion
      version, Boolean allowPrereleaseVersions)
      WARNING: NuGet: at NuGet.PackageManager.InstallPackage(String packageId, SemanticVersion version, Boolean
      ignoreDependencies, Boolean allowPrereleaseVersions)
      WARNING: NuGet: at NuGet.Commands.InstallCommand.InstallPackage(IFileSystem fileSystem, String packageId,
      SemanticVersion version)
      WARNING: NuGet: at NuGet.Program.Main(String[] args)

      Also, I am able to install things from provider “PowerShellGet” / source “PSGallery”  and my nuget.config looks like this:
      <?xml version="1.0" encoding="utf-8"?>
      <configuration>
      <packageRestore>
      <add key="enabled" value="True" />
      <add key="automatic" value="True" />
      </packageRestore>
      <packageSources>
      <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
      <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
      </packageSources>
      <disabledPackageSources />
      <activePackageSource>
      <add key="All" value="(Aggregate source)" />
      </activePackageSource>
      </configuration>

      I can’t do anything in powershell, send help.

    • #234688
      Participant
      Topics: 3
      Replies: 431
      Points: 1,533
      Helping Hand
      Rank: Community Hero

      Take a look at the different answers on this thread. They range from checking your clock/date to editing your nuget.config.
      https://stackoverflow.com/questions/38734040/nuget-unable-to-find-version-of-package

    • #234877
      Participant
      Topics: 1
      Replies: 2
      Points: 20
      Rank: Member

      Hello, thank you for a response. Sadly enough I have seen that post already. Doing dotnet yields a term not recognized error, as well as trying to run something with nuget or nuget.exe. I also don’t know where the packages.config file is. My clock does not seem to be off at all either. Ah and yes I already did edit my nuget.config, before I did it was actually completely useless as if it hadn’t installed all the way. This only thing in the file was just <!--?xml version="1.0"?--> and that’s it!
      Also I do have .net 4.8 from my optional features list so if it’s not showing up in my powershell I’m thinking that either my optional features are bugged which is why I can’t uninstall powershell, or there is a real powershell somewhere on my computer that works and does have .net and somehow I have this weird, ,detached from the system, and nonfunctional powershell. This is so confusing

    • #235090
      Participant
      Topics: 3
      Replies: 431
      Points: 1,533
      Helping Hand
      Rank: Community Hero

      OK let’s slow it down here and take it a step at a time. First, you say

      when I disable powershell as a feature on my computer it does not uninstall powershell like it’s supposed to

      Windows Powershell is part of windows. Are you referring to version 2.0? Can you provide the documentation you’re referring to when saying “like it’s supposed to”?

      Next, you say

      Also, I am able to install things from provider “PowerShellGet” / source “PSGallery” and my nuget.config looks like this:

      and then follow that up with

      I can’t do anything in powershell, send help.

      Which is it? Lastly, you say

      Doing dotnet yields a term not recognized error, as well as trying to run something with nuget or nuget.exe

      I recommend exploring that before moving on. If nuget is broke, fix it. If your command says “who is nuget.exe” then it’s up to you to point to the path of nuget.exe. (maybe you need to download it and run manually) A quick search led me to this page https://www.nuget.org/packages/NuGet.exe/ where I manually downloaded https://www.nuget.org/api/v2/package/NuGet.exe/3.4.3 and used 7zip to extract it. Navigated the admin command prompt (powershell in my case, but it seems you’ll need CMD) to the extracted folder that contained nuget.exe (\users\me\downloads\nuget extracted\build\native) and ran

      .\nuget.exe update -self

      What happens if you do the same thing? Also, make a note of the big yellow banner on the nuget page. Hope this helps.

    • #235153
      Participant
      Topics: 1
      Replies: 2
      Points: 20
      Rank: Member

      Yes, in multiple threads which you can find by googling “how to uninstall powershell” which I already found out you can’t literally do, community members say that you can go into optionalfeatures.exe to disable powershell, apply your changes, and restart your computer to practically delete powershell. Afterwards you can repeat the steps to enable powershell and it will be to factory standards. Hypothetically at least because that didn’t work for me as once powershell was disabled it remained on my computer after the restart and nothing happened when I enabled powershell again.
      I’m not entirely sure what version this is, it’s in a folder called “v1.0” but when I look for the actual version of powershell it tells me 5.1. Neither of which is version 2.0 or 4.0 which I’m getting the feeling most people use.
      There are not a lot of packages that you can download from PowerShellGet / PSGallery and if I only stuck to using those I would be severely limited. From what I gather PowerShellGet is a local repository that windows provides with your operating system with sources to some essential and/or windows approved powershell addons. The problem is that I need one of those repositories that isn’t windows so that they have the good stuff, and isn’t chocolatey because I guess the chocolatey entries don’t actually point to anything and my powershell is covered in chocolate. Those sentences are chaos I’m sorry.
      Oh and also I used nuget to download nuget version 1.3.3 installed from PowerShellGet. The original version of nuget that I have is from a prompt that powershell gave me the first time I tried to install something that told me I needed to download nuget first. Then I got version 5.5.1 from that source after updating. When I do Install-package it still gives me the same error though.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.