Nuget “minVersion” attribute error

07. January 2011 Howto 0

I just got moved to a new project, and as part of one of my first tasks I needed to add an assembly to the project.  I knew we had done some Nuget packages so I right clicked on my project and chose “Add Library Package Reference”

Media_httpblogpaleloc_tfwxj

When I clicked on this, after about 3 or 4 seconds a big dialog box came up.  It had a lot of text and said “The ‘minVersion’ attribute is not declared.”  I conferred with my teammates and some of them told me they had problems with the GUI and I should use the Package Manager Console.  So I did.  I followed the instructions online and got a similar error.

Media_httpblogpaleloc_iszra

I hit the NuGet board and found out that sometime mid-December they released a breaking change where the minVersion attribute was no longer used in defining dependencies. However, I figured it had to be something along those lines just from the error message. I create a blank solution and inserted each of our 7 projects into that solution.  I then created a packages folder in my new solution’s directory.

 I copied over each of our NuGet packages one-by-one and tried doing a “Add Library Package Reference…” after each copy. I finally identified 2 of our packages that caused my warning dialog.  As I opened their projects, and looked at their nuspec file, I noticed there was a “minVersion” attribute.  I deleted that, rebuilt the NuGet packages, copied them out to our local repository and tried again. Still no luck. That’s when I realized there were several versions in our local repository of these NuGet packages.  I moved all but the ones I’d just built out of the repository.  Instantly NuGet worked like a champ. It appears that NuGet was analyzing each nupkg file when it went to load the repository.  As soon as it choked on one using the ‘minVersion’ attribute it died. So if your’e getting the error above, and you have control over any of your NuGet packages, make sure they’re not using the ‘minVersion’ attribute, and make sure any that are, have been cleaned from your repository.


Leave a Reply

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