In the previous company I was working for we had centralized NuGet versioning. There was one file containing all NuGet references and it’s version. With this approach, update in one file can update all projects using chosen NuGet. Isn’t it nice? How many time did you update NuGet in project A but forgot to do it in project B?

It happened that recently I started another Xamarin project from and I wanted to achieve the same. I didn’t find step by step how to do it, so let me write how I did it.

Before you proceed

In order to fully understood what centralized NuGet versioning is, you need to read an article by Rodney Littles II. My article is only a missing puzzle explaining how to do it as I was struggling a bit to adjust to this in existing solution.

1. Create packages.props file

In order to do it, open each csproj file that you have in your solution and move each nuget to packages.props.

Having csproj looking like this

you should make packages.props like this

and adjust your csproj files to look (more or less) like this

As you can see above, now your new.csproj does not have package version. It will get it from packages.props file.

One more thing to add here. If you didn’t notice it in Rodney’s sample repo, packages.props file should be created in the root of the solution. Check his repository if you still wonder where you should place it (link in his article).

2. Add file

Having edited csproj files, we need to add one more file. It will be really simple file in our case.

Put it in the root folder, next to your packages.props.

By the time I am writing this article, the latest version of Microsoft.Build.CentralPackageVersion is 2.0.79. It will get outdated, so before you add it, check for the latest one in NuGet.

If you want to learn more about file, here is a good starting point.


That’s it. Right now you should have working solution with centralized NuGet versioning. If I wrote something stupid or the solution above is not working then please let me know.

One thought to “Centralised NuGet versioning in Xamarin.”

Leave a Reply

Your email address will not be published. Required fields are marked *