Skip to main content

Posts

Showing posts with the label Restore

Ways to add dependency packages in .NET core

This would be a very short article on how to add dependencies in .Net Core . Well, there are many ways to achieve this. One is via Visual Studio and another way is through command prompt. Let’s quickly have a look.  1) From Visual Studio:  This is the straight forward way for the ones who want to use user interface to add dependencies. Right click on your project/library and get it from Nuget gallery.  2) From Command Prompt:   If you are a command prompt fan, then there itself, you have 2 choices. A) Open command prompt. Navigate to your project directory and simply fire: C:\<Your project directory> dotnet add package Microsoft.AspNetCore   B) Alternative you can go and add the reference directly in .csproj file as shown below: and restore it from command prompt using very simple command: C:\<Your project directory> dotnet restore Happy learning!!!

Restoring Nuget packages in less annoying way

Hope most of you are aware of Nuget packages. It is a way to get 3rd party libraries into your project. Nuget also makes developer's life easier by checking for updates for all the available libraries. Apart from this Nuget also provides package restoration option, which is disabled by default. Another annoying thing about restoration is, it is very very slow. So, it means that until your restoration is complete, you can not do anything. What is the solution or workaround of this slow restoration of Nuget package ? Well, one workaround can be instead of restoring packages from Visual Studio, why can't we do it outside of Visual Studio. Interesting, isn't it ??? A Very simple and straight forward command to do this is: NuGet.exe restore [SolutionFile] –PackagesDirectory [PackagesDirectory]