How do i install a package I downloaded manually into visual studio? - visual-studio

I dont do this very often so excuse me the question is so basic.
I found an example of parallax effect online I wanted to test.
called paroller.js
So the site offered for me to download their package and I did, its now on my desktop.
And now I have no idea how to include this in my solution, I went to nuget package manager to search for it, but cannot find it.
Link to where i got it from: https://tgomilar.github.io/paroller.js/
I tried using the nuget package manager, and I googled a million different ways to install packages into solutions and all want me to use the package manager

The only thing that nuget does is to download the files build them ( if needed) and add the required references. So, you apparently want to add a js lib. You should look for the dist folder in the package that you want and import it in your page.
Note if there is not dist folder you may need to build the package which is not that simple.

Related

How do I load code into a specified directory using Nuget?

I have the situation where our code base is like so:
/Gui/
/Product1/
/Calc engine/
/Core/
/Product2/
All of these projects are loaded into a Global solution file in Visual Studio.
I want to extract Core to it's own repo and allow different branches of this repo to load different versions of it. I cannot just use references to the binaries as engineers want to be able to debug the core code when running the Products so I have to be able to bring the entire Core codebase in.
Originally, I intended to use git submodules but I am investigating whether Nuget might be a better solution. I have removed /Core/ to it's own repo and created a Nuget package of the Core directory (it contains about 20 different C# projects).
Is there a way I can input this Nuget package into the Global Solution? It would need to put the code into the same directory as it used to rather than a package director.
Is there a way I can input this Nuget package into the Global Solution? It would need to put the code into the same directory as it used to rather than a package director.
You can change the Package Management to "Pakcage.config" in Options\Nuget Package Manager. The package will be stored in solution directory.
and right-click the solution in solution explorer then click "Manage Nuget Packages for Solution"

Global package installation using NuGet

Does NuGet support global package installation like NPM and Composer? If so, how do I do that? Also, how do I reference globally installed packages in my Visual Studio projects?
So learning from #Lance's tips, I went ahead and checked %userprofile%\.nuget\packages folder, and indeed it contains all the packages that I have downloaded in the past. Unfortunately though, Visual Studio (I'm using Community 2019) does not allow you to install any of these packages into a new project. The Browse page in NuGet Package Manager UI displays online results only from nuget.org.
But then I found another clue. In Visual Studio Tools > Options > NuGet Package Manager > Package Sources, you can add custom sources. So I went ahead and added my cache folder as an alternate source.
Note that there is a separate "Machine-wide package sources" entry too that cannot be modified. I checked that folder and it contains mostly Microsoft's own packages (one exception that I found there was NewtonSoft.json). I have no idea how this folder is different from the nuget cache folder and how I can download a package to this folder.
So far so good. The Package Manager now shows all previously downloaded packages from cache when I select this source from the drop down (sources dropdown is in top-right corner). I can then select a package and install it from local source instead of downloading it from the Internet.
Hope this helps someone down the line.

Nuget Package Custom Visual Studio Destination Folder

This is an issue I am having with most js/css nuget packages but I'll use JQuery as an example here.
When I install the nuget package for JQuery, it installs the JQuery js file(s) into the "Scripts" folder in the solution.
I have a custom folder (~/Assets/Js) that I want them to go into for better organization.
Obviously I can drag them into that folder and rearrange them manually but its annoying having to do that every time I update or install a new nuget package.
Is there a way for me to specify a custom nuget destination folder for a package?
Thanks in advance!
No,
without changing the package before installing, you can't change that destination.
It's a choice made by the developer of the package.
If you want a wild idea for a solution, download the code for the Nugget manager and add custom code for
your development environment ( but this is overkill for your annoyance...)
JQuery is open source.
--> Maybe propose a change to the guys who maintain JQuery...

NuGet package fails to install

We've got some internal reusable libraries that we're currently juggling around at my place of work. I thought it would be nice to chuck some of these on an internal NuGet server. Unfortunately this is proving harder than planned.
The package I'm trialing this with is a simple JavaScript library. I created a folder called Package containing a folder called Scripts, which I put the JS files in. I then opened a command prompt at the Package folder and ran NuGet spec which ran successfully. Then I edited the .nuspec file and ran NuGet pack, generating a .nupkg file.
Great, works perfectly. I added the folder containing the .nupkg file as a NuGet source. I can now run (from the commandline) NuGet install and it works fine!
I have a test project all set up and ready to go for this library, the only thing left is to install the package. So in Visual Studio I go into Manage NuGet Packages and select my source. I select my library and hit install and a dialog pops up showing progress. It says "successfully installed" and all that and then exits. However in Manage NuGet Packages the install button HAS NOT changed to an uninstall button, the package does not show up under Installed Packages and none of the files from the package have been added to my project or exist on the disk. Clicking on the install button subsequent times does absolutely nothing.
Not really sure what I'm doing wrong, would very much appreciate some help.
Thanks,
YM
EDIT: I should mention that I can install other packages just fine, and I have tried installing this package in a different solution with the same result.
Okay, the issue was that the Scripts folder should not go directly in the root directory of the package, but instead must sit under a Content folder. That took me a long time to work out, hopefully it helps someone else.

ASP.NET Web Application & NuGet - Package Updates Not Referenced

I've got an ASP.NET Web Application (in the formal sense, it's not a "Web Site" project). It references some number of NuGet packages (let's call them all v1.0).
If I edit packages.config to reference a newer version of one of the NuGet packages and build, restore packages, or attempt to update the packages everything seems fine. It downloads the new package, creates a folder for it and the whole deal.
The problem comes when I attempt to reference newly added classes or properties within that package. (Let's call it v2.0.)
IntelliSense doesn't know about them. When I start trying to figure out why, I find that it's still referencing v1.0. It has downloaded 2.0, and the package file asks that it should use 2.0, but unless I explicitly remove the reference to the package and re-add it, VisualStudio seems content to stick with v1.0.
I feel like I must be doing something wrong, or at some point in time something has been configured incorrectly, but I'm at a loss as to what that might be.
Any advice?
You shouldn't update packages.config to get new package versions. Package Restore simply downloads the package files. It doesn't update references, etc.
To update a package you can use the Manage NuGet Packages dialog to install updates or use the Package Manager Console and type: Update-Package

Resources