NuGet Package Manager's package source is not available - nuget-package

I need to use the NuGet Package Manger to install some packages for my project, however, I find that I cannot use it in Package Manager Console: I cannot type anything and see the package source is not available, it is grey.

Related

Nuget not searching in custom package sources

I have added 2 custom package sources. If I search in nuget package manager, I find my package. If I install the package it fails with the following error:
Restoring packages for .NETStandard,Version=v2.1...
GET https://api.nuget.org/v3-flatcontainer/mypackage.test/index.json
NotFound https://api.nuget.org/v3-flatcontainer/mypackage.test/index.json 125ms
Resolving conflicts for .NETStandard,Version=v2.1...
Unable to find package mypackage.test. No packages exist with this id in source(s): nuget.org
Package restore failed. Rolling back package changes for 'FormsApp1'.
In the logging I see that package manager only searches in nuget.org and not in my custom sources.
I am using VS for mac 17.4.2, Nuget 6.4.0.117
Questions:
How do I tell package manager to also search in my custom sources?
How do I install a specific version of nuget on Mac? I would like to try version 6.3.1.1.
I solved this issue by installing VS2019.
When installing VS2019 it replaces VS2022. But you can install VS2022 Preview alongside. After installing VS2019, the package manager works correctly in VS2019 as well as VS2022 Preview.
So I guess the installation of VS2022 is broken as it was a fresh install on a new laptop.

Cabal: only work with checked in libraries in project directory

I would like to download all the dependencies of my cabal project to my project directory/repository and force cabal to never use ~/.cabal/ and never download any new dependency from the internet. The downloaded libraries should be system independent (not include local paths etc.). Is this possible?
The idea behind this is, to copy the project directory to another (offline) system where the same ghc is installed and it should work out of the box.
According to the cabal docs, you can set active-repositories: none in your cabal.project or cabal file to put cabal-install in offline mode.
Then, you could create a cabal project and try to make all the dependencies that don't come bundled with GHC itself local packages. Clone them in your project folder and add them to the packages: section of cabal.project.
The problem with the above is that running cabal clean would require re-compiling all packages afterwards.
As an alternative, create a local no-index package repository in your offline machine, make it the only available package repository using active-repositories:, and put the sdist tarballs of all your dependencies there.
That way the dependencies will only be compiled once.

How do I install an older version of Nuget package and its dependencies and save them to packages.config

I am trying to install a version of a package that is not the latest on the public Nuget repository. (because each version requires blessings from the corporate technology controls department) With the Package Manager UI in Visual Studio 2012, I did not find an option to install an older version. With the commandline tool, I don't see an option to save the package version and its dependency versions into packages.config (which the UI does automatically). The package has 50 dependencies and sub-dependencies. Is there a way to achieve both older version and save to packages.config?

bower.json manually adding dependency of installed package

I installed package with bower.
This package has dependency of another package, but bower doesn't know it.
How do I manually add installed package dependency to be something in bower.json file?
There is no official way of doing this so here are a number of solutions:
fork the project on on github for example, add the correct dependencies in bower.json and use that repo in your own project (optionally you can then issue a pull request to the origin author)
use the unofficial overrides property to override the package dependencies as need, and then use a build tool such as main-bower-files, wiredep
use a custom pluggable resolver (a bit of an overkill just for this)
Install package again with command: bower install --save

Installing packages (via cabal) from "local hackage"

Is it possible to get cabal to
Download a particular package source, including all dependency packages sources.
At a later stage (when internet connectivity can no longer be relied upon) install these packages via cabal, from the locally downloaded files, automatically in the right order so that the desired package is build?
I know that you can use cabal unpack to view the source of a particular package, but I am not sure how to achieve above. Also note that in this post Can't get cabal update to work inside corporate network it was mentioned that this could be done, but the instructions were not specific enough for me.
cabal help | grep fetch:
fetch Downloads packages for later installation.
Example:
$ cabal fetch unbound
Resolving dependencies...
Downloading RepLib-0.5.3.1...
Downloading type-equality-0.1.1...
Downloading unbound-0.4.1.1...
Running cabal install unbound at a later stage won't require Internet access.

Resources