Running PowerShell scripts under Visual Studio automatically updates the version of the AssemblyInfo.cs file in the project (self-increment minor version number) and publish to the NuGet server
Attached script "Update.ps1 file contents":
$path = "Properties\assemblyinfo.cs" $pattern = ' \[assembly:assemblyversion\ ("(. *)" \) \] ' (get-content $path) | Foreach-object{if ($_-match $pattern) {# We have found the matching line# Edit the version number and put it back. $fileVersion = [Version] $matches [1] $newVersion = "{0}. {1}. {2}. {3} "-F $fileVersion. Major, $fileVersion. Minor, $fileVersion. Build, ($fileVersion. Revision + 1) ' [assembly: AssemblyVersion ("{0}")] '-f $newVersion} else {# Output line as Is$_}} | Set-content $path -encoding utf8$pattern = ' \[assembly:assemblyfileversion\ ("(. *)" \) \] ' (get-content $path) | Foreach-object{if ($_-match $pattern) {# We have found the matching line# Edit the version number and put it back. $fileVersion = [Version] $matches [1] $newVersion = "{0}. {1}. {2}. {3} "-F $fileVersion. Major, $fileVersion. Minor, $fileVersion. Build, ($fileVersion. Revision + 1) ' [assembly: Assemblyfileversion ("{0}")] '-f $newVersion} else {# Output line as Is$_}} | Set-content $path -encoding utf8nuget pack -BUILD-OUTPUTfilenameswithoutversionnuget Push-source " http://****"-apikey {Password} demo.nupkg
Running PowerShell scripts under Visual Studio automatically updates the version of the AssemblyInfo.cs file in the project (self-increment iteration number) and publishes it to the NuGet server