Skip to content

Instantly share code, notes, and snippets.



Created May 30, 2019
What would you like to do?
Clickonce - update minimum version on publish
Install the NuGet package 'AutoUpdateProjectsMinimumRequiredClickOnceVersion'
remove the post build task and add the following to the .csproj / .vbproj
<!-- #1 Place this line at the top of any msbuild script (ie, csproj, etc) -->
<PowerShell># 2>nul || type %~df0|find /v "setlocal"|find /v "errorlevel"|powershell.exe -noninteractive -executionpolicy Unrestricted -&amp; exit %errorlevel% || #</PowerShell>
<!-- #2 in any target you want to run a script -->
<Target Name="BeforePublish" >
<PropertyGroup> <!-- #3 prefix your powershell script with the $(PowerShell) variable, then code as normal! -->
cd $(ProjectDir)PostBuildScripts
.\AutoUpdateProjectsMinimumRequiredClickOnceVersion.ps1 -ProjectFilePaths "$(ProjectPath)"
<!-- #4 and execute the script like this -->
<Exec Command="$(myscript)" EchoOff="true" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment