Skip to content

Instantly share code, notes, and snippets.

Simon Keen ximon

Block or report user

Report or block ximon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ximon
ximon / Test.csproj
Created May 30, 2019 — forked from fearthecowboy/Test.csproj
The definitive way to use PowerShell from an msbuild script
View Test.csproj
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- #1 Place this line at the top of any msbuild script (ie, csproj, etc) -->
<PropertyGroup><PowerShell># 2>nul || type %~df0|find /v "setlocal"|find /v "errorlevel"|powershell.exe -noninteractive -&amp; exit %errorlevel% || #</PowerShell></PropertyGroup>
<!-- #2 in any target you want to run a script -->
<Target Name="default" >
<PropertyGroup> <!-- #3 prefix your powershell script with the $(PowerShell) variable, then code as normal! -->
<myscript>$(PowerShell)
@ximon
ximon / .cs_or_vbproj
Created May 30, 2019
Clickonce - update minimum version on publish
View .cs_or_vbproj
<!--
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) -->
<PropertyGroup>
<PowerShell># 2>nul || type %~df0|find /v "setlocal"|find /v "errorlevel"|powershell.exe -noninteractive -executionpolicy Unrestricted -&amp; exit %errorlevel% || #</PowerShell>
</PropertyGroup>
You can’t perform that action at this time.