Tim Van Wassenhove

Passionate geek, interested in Technology. Proud father of two

07 Nov 2010

Invoke PowerShell script from MSBuild

Here is a small MSBuild target that allows you to invoke a PowerShell script, eg: powershell.exe & ‘script.ps1’ -SomeParam ‘x’

<Target Name="InvokePowerShell">
	<PropertyGroup>
		<PowerShellCommand>"$(PowerShellTool)" "& '$(ScriptFile)' -SomeParam '$(SomeParam)' "</PowerShellCommand>
	</PropertyGroup>
	<Exec Command="$(PowerShellCommand)" />
</Target>