Tuesday, March 15, 2016

Nuget and AssemblyInformationalAttribute

After uploading some updated Nuget packages I noticed they did not appear in the Visual Studio 2015 nuget.org browse results or in any package lists from the command line tools. A day later I was quite worried, so after running a bulk file comparison with the versions that were last visible in Nuget I noticed only one suspicious difference: I had added an AssemblyInformationalAttribute to the projects. I had placed a build time string in this attribute, something I thought would be handy when looking at the properties.

Web searches soon revealed that this attribute has special meaning to Nuget (see Nuget Versioning). My value did not match any conventional format mentioned in the article, so there's no way of guessing how it was interpreted. The unfortunate result was that the packages were perhaps regarded as some kind of pre-release, but they didn't show up even when that browse option was ticked.

I always assumed that this attribute was simply an additional comment for annotating executable images and had no special meaning to Windows or Nuget. It's easy to miss the Nuget "fine print" regarding this attribute. Don't use it unless you've read the documentation.