Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active February 23, 2018 12:13
Show Gist options
  • Save unitycoder/c4c5330ad3494ee5b2344a0a86324a3d to your computer and use it in GitHub Desktop.
Save unitycoder/c4c5330ad3494ee5b2344a0a86324a3d to your computer and use it in GitHub Desktop.
Fetch Github Latest Release "tag_name" with PowerShell in Visual Studio Pre-Build Event
powershell.exe -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;$web = New-Object System.Net.WebClient;$web.Headers['User-Agent'] = 'DefinitelyBrowser';$results = $web.DownloadString('https://api.github.com/repos/user/repo/releases/latest');$results = $results | ConvertFrom-Json;$results = $results | select -expand tag_name;echo $results | Out-File $(ProjectDir)PreviousVersion.txt;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment