nuget: package version is not being updated

update nuget package manager visual studio 2017
nuget exe specify msbuild version
force nuget to use a specific version of msbuild
nuspec file
nuget package restore command
uninstall nuget package command
nuget pack prerelease
manage nuget packages for solution missing 2019

I'm trying to pack a new version of a custom NuGet package and when I use the pack command I'm getting a .nupkg file which has a version number that doesn't match with the one that I've specified in the .nuspec file.

Example:

nuget pack mypackage.csproj -IncludeReferencedProjects -Prop Configuration=Release

.nuspec file:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>mypackage</id>
    <version>1.0.1</version>
    <authors>me</authors>
    <owners>me</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>blah</description>
    <releaseNotes></releaseNotes>
    <copyright>Copyright 2016</copyright>
    <tags>tag1 tag2</tags>
    <dependencies>
    </dependencies>
  </metadata>
</package>

I should get a file named mypackage.1.0.1.nupkg, but I'm getting a file named mypackage.1.0.0.nupkg instead

I'm also getting the same result when I try to pack it by using the AssemblyInfo data included in the Properties\AssemblyInfo.cs and declaring the version as a variable in the .nuspec file:

Properties\AssemblyInfo.cs ... [assembly: AssemblyVersion("1.0.1")] ...

Should I look for another properties in my project to update my NuGet package?

SOLUTION: Ignored the .nuspec file and managed the package versions via .csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net451;net452</TargetFrameworks>
    ...
    <AssemblyVersion>1.2.1</AssemblyVersion>
</Project>

Thanks in advance!

I fell foul of this recent as well. You need to use the Properties\AssemblyFileVersion attribute to set the correct value for a nuget package

[assembly: AssemblyFileVersion("1.0.1")]

NuGet package manager not detecting new versions in feed , Closed - Duplicate windows 10.0visual studio 2017 version I try to update my other project but nuget package manager does not see the Newly published packages can sometimes take hours to be available for update. If set, instead of updating the package to the latest version, NuGet will uninstall the package and reinstall the same version. This is useful when, for example, you’ve updated the target framework of your project, e.g. from .NET 4.0 to .NET 4.5, and you want to reference .NET 4.5-specific assemblies in the package.

  1. Make sure to change both the Assembly Version and File Version in Project Properties > Application > Assembly Information.
  2. After that make sure you are set to Release mode and build your project.
  3. Execute the Nuget Spec command in your project's folder
  4. Edit the Spec, version should be set to $version$ so as to grab it from your project, remove the lines that need removing, fill the ones with placeholders.
  5. Execute your Nuget Pack command in the same folder and you should be good.

I often forget to build my project so it doesn't update the version.

Reinstalling and Updating NuGet Packages, Updating a package simply means installing an updated version, which Project is broken due to deleted files: NuGet does not prevent you from build warnings let you know that the package may need to be reinstalled. If the package name is available, nuget.org opens a Verify section in which you can review the metadata from the package manifest. To change any of the metadata, edit your project (project file or.nuspec file), rebuild, recreate the package, and upload again.

Well, I've finally managed to update my version by packing using the AssemblyInfo version. It seems like my publishing process for this package is completely ignoring the .nuspec file and gets the version from the last compiled source.

Install and manage NuGet packages in Visual Studio, Instructions for using the NuGet Package Manager UI in Visual Studio for Select the package to update, select the desired version from the drop-down version into all selected projects, after which the package no longer  This situation commonly occurs when you obtain the project's source code from source control or another download. Packages are typically omitted from source control or downloads because they can be restored from package feeds like nuget.org (see Packages and source control). Including them would otherwise bloat the repository or create unnecessarily large .zip files.

Generate NuGet package on build does not use the correct package , Looks like PackageVersion is used to generate nuget version but VS settings are updating Version tag. I have no idea what is it for. It still an issue  Update-Package -Id <package_name> –reinstall. Using this command is much easier than removing a package and then trying to locate the same package in the NuGet gallery with the same version. Note that the -Id switch is optional. The same command without -reinstall updates a package to a newer version, if applicable.

Installing Episerver updates, Episerver continuously releases updates with new features and bug Add the Episerver NuGet feed to the NuGet package manager in Visual Studio (if not Note: NuGet package manager has to be version 2.8.50126.477 or  If a dependency version is already satisfied, the dependency isn't updated during other package installations. For example, consider package A that depends on package B and specifies 1.0 for the version number. The source repository contains versions 1.0, 1.1, and 1.2 of package B.

Updating Packages | General Information, In this case, launch the Project Converter tool to update the references to the correct version numbers after updating DevExpress NuGet packages. Install a specific version of a package If the version is not specified, NuGet installs the latest version of the package. You can also use the dotnet add package command to install a specific version of a Nuget package:

Comments
  • See nuspec and csproj package version tags
  • could you post your solution how you get your nuget package version using the AssemblyInfo?
  • Firs post edited with the solution :)