Niranjan Godbole
Niranjan Godbole

Reputation: 2175

Add package references to webapi in .net core

net core environment. I m creating .net core webapi project in visual studio project. I am following https://github.com/allebb/lk2.git project to get hands on with .net core. when i open this solution in visual studio i can see lot of packages installed in dependencies tab as below.

enter image description here

same way i created solution in visual studio 2017 and i got

enter image description here I can see many packages compared to the sample solution. How can i add all those reference in my test project? Parallel i have setup ubuntu environment with core 2.0 setup. But i am missing many packages in my test project! May i know how can i those missing packages? Any help would be appreciated. Thanks

Upvotes: 0

Views: 1144

Answers (1)

Neville Nazerane
Neville Nazerane

Reputation: 7019

These packages are commonly used for database connections and serializing. They are quite popular and you are quite likely to use them once you start creating web applications. There are couple of ways to add them as nuget packages.

  1. Right click on your project and go to "manage nuget packages"
  2. Open the package manager and enter the code install-package package.name
  3. open command prompt and add the code dotnet add package package.name

For more information you can look up nuget.org. If you want exactly the same libraries, the quickest way is open the csproj file of the git https://github.com/allebb/lk2/blob/master/lk2-demo.csproj and copy the whole <ItemGroup> section that contains the PackageReference. Then you can right click on your project and go to restore nuget packages.

To restore the projects via command line (what you can use in linux)

dotnet restore

Update: Since most nugets seem to be of an older version. The quickest would be to copy the references as they are and update all nugets from the nuget manager in one go.

Upvotes: 1

Related Questions