-1

I'm just start learning about dotnet, I start to interact with it using CLI , And I found myself a little overwhelmed about the following :
I Created a dotnet console app and I started writing some code and I used some NuGet packages so when I finished I tried to run my app using the dotnet run command I noticed that dotnet restore runs behind scenes.
My question is :
-If I could access to all interfaces within the Nuget that I referenced in the .csproj and use them in my app Why he needs to run dotnet restore ?( because I assumed when I reference packages that means he will do restore that's why I'm able to use classes ... provided by package in code )
-Does referencing packages in .csproj file mean bring all the code source of the packages ?
Thank you

byteram
  • 125
  • 8

1 Answers1

0

Does referencing packages in .csproj file mean bring all the code source of the packages ?

No. NuGet packages are typically the assemblies only. (They can also be used for client side assets, like jQuery, in which case they do contain the source code because that is what you need on the client).

If I could access to all interfaces within the Nuget that I referenced in the .csproj and use them in my app Why he needs to run dotnet restore ?

Restoring covers the case where you're NuGet cache does not contain all the needed packages at the right version (eg. you've just forked a repo to make some changes).

Richard
  • 106,783
  • 21
  • 203
  • 265