Home > database >  how are dependencies managed in C#?
how are dependencies managed in C#?

Time:12-06

how are dependencies managed in C# ? For example in java there is maven (pom.xml), and in JS there is npm (package.json), and in C# there is nuget... but what is the alternative of pom.xml in C# ?

Is that maybe .csproj file ?

CodePudding user response:

The package manager for .NET C# is enter image description here enter image description here

Same can be done for the whole solution: enter image description here

From the command line you can work with nuget.exe, or dotnet.exe;

nuget install Flurl -Version 3.0.6
dotnet add package Flurl --version 3.0.6

There are also the nuget package manager console intergrated into visual studio:

enter image description here

You can select a default project from the dropdown, and then call Install-Package.

Generally most library repositories on github have either a link to the package on nuget.org or have a snippet to directly install the package via the nuget package manager console.

For example a random library enter image description here

CodePudding user response:

As a complement for answer by @sommmen - there is a recent addition to package management in .NET - central package management which allows to centrally manage package versions in C# solutions via Directory.Packages.props file.

  • Related