NuGet / Home

Repo for NuGet Client issues
Other
1.49k stars 250 forks source link

VS2017 GeneratePackageOnBuild produces 1.0.0 package #6972

Open phatcher opened 6 years ago

phatcher commented 6 years ago

Details about Problem

If I look at the project details it shows the correct versions, but if I compile with VS2017 it always generated a 1.0.0.0 packaged. The assemblies themselves have the correct version info

VS version (if appropriate): VS2017.7.1

Sample Project

See https://github.com/phatcher/CsvReader

zhili1208 commented 6 years ago

@rohit21agrawal

dasMulli commented 6 years ago

quick analysis: The reason is that the project uses custom assembly attributes, has assembly attributes turned off and doesn't set any version-related MSBuild property.

The package targets currently don't read the package version from assembly attributes, so you'd need to set the VersionPrefix / Version or PackageVersion in the csproj file or else they default to 1.0.0.

An alternative workaround would by adding the targets from the answer in https://stackoverflow.com/questions/48065516/build-project-with-multiple-targetframeworks-in-tfs-as-nuget-package (also needs the GenerateNuspecDependsOn property from the question) to the csproj file. (currently only works on visual studio's MSBuild version or upcoming 2.1.300 dotnet CLI)

dasMulli commented 6 years ago

There has already been a discussion about this over at https://github.com/dotnet/cli/issues/8399