Update NuSpec version from MsBuild
Here’s the sample script that updates NuGet version node in NuSpec file:
<target Name="UpdateNuspec"> <getAssemblyIdentity AssemblyFiles="$(ReleaseFolder)/Redistributables/YourAssembly.dll"> <output TaskParameter="Assemblies" ItemName="YourAssemblyInfo"/> </getAssemblyIdentity> <xmlUpdate Prefix="nu" Namespace="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" XmlFileName="YourAssembly.nuspec" XPath="package/nu:metadata/nu:version" Value="%(YourAssemblyInfo.Version)"/> </target>