Problems with Packages
I have a long standing library that is currently written based on .NET Standard. It hasn’t been changed for a while and when I recently updated it I noticed that it was not producing the version number I expected. I first checked TeamCity to attempt to determine if it was just this package that was affected. Having synchronised the build with one that I knew worked, this issue was still happening. My next step was to try the pack using Visual Studio, same issue. Dotnet pack from command line, same issue. As the library uses Paket I tried paket pack, I even tried using Rider.
As it happened the csproj for this library was somehow corrupted in Visual Studio. When I opened the file using VS all of the colours didn’t follow the ones I expected for my colour scheme which made it incredibly difficult to read. Other files didn’t seem to be affected nor did other IDE’s. This made me wonder if there was something wrong with the file itself, so I tried editing the project properties in VS in the hope it would clear the issue. As this didn’t work I explicitly declared AssemblyFileVersion and AssemblyVersion in the csproj. There was nothing I could find on the web which suggested that this was not a known issue.
It was after this that I happened to notice a line in csproj that I hadn’t noticed before
This doesn’t seem to be particularly well documented and it overrides any other version information in your project files. It does however take any string e.g. 2.1.3-RC and defaults to the value of Version, so I’m not entirely sure what the point of it is. As I’m sure you realised, removing this line fixed my issue and so my builds are now working correctly again