Skip to content

NugGet Packages

Things to take in mind when working with NuGet Packages on the monorepo.

A note on csproj, props, targets, and other MSBuild files

Please bear in mind that these files are considered source code, hence it must be correctly formatted and treated as such:

  1. .csproj
  2. .props
  3. .targets

Package Management in Monorepo

We use Central Package Management for managing our NuGet packages, which is a preview feature. This allows us to centrally control all versions of packages being used. Remember, we want to use the same version of third party dependencies for all projects inside the repo.

Note that Visual Studio user interface is still being worked on to support this feature. Not everything that is mentioned on the previous link is implemented yet.

If you need to reference a currently used package to your project, simply add a <PackageReference> without a Version attribute. The version will be picked from the Directory.Packages.props

If you need to reference a new package, you need to add it to the Directory.Packages.props file first using a <PackageVersion> element, and then use a <PackageReference> on your csproj file without the Version attribute.

When choosing the new package's version, try to use the latest version possible. If the package you are adding is part of the .NET meta-packages, please use the same version as other currently installed packages.