testing for multiple nuget package versions

If you are working on any reasonable sized solution in C#, it’s likely you will be using the at least  one NuGet package across two or more projects. When the time comes for one of your team to add the package to another project, they will probably select the latest version by default without thinking, leaving you with multiple packages across a single solution. This can lead to unexpected issues (msbuild/octopack being the one we ran into).

Below is a handy test I knocked up, which you should be able to copy/paste into any solution to prevent this happening. Just edit the relative path to your solution. It outputs the commands needed to run the the Package Manage Console to get it passing.

Leave a Reply