Use a Powershell script as a build eventCopy link to this sectionLink to this section copied!

ImportantThe following article uses options that are available starting with the Professional edition and project type.

This article will guide you on how to use a Powershell script as a Build Event.

The first step is to go to Build page, Build Events tab and add a new build event.

Configure the build event to launch powershell.exe (C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe).

Use the following parameters in argumets field: -windowstyle hidden -Executionpolicy bypass -File "[|AI_AIP_FOLDER]Display messagebox.ps1" .

In our example Display messagebox.ps1 is a sample Powershell script that displays a messagebox:

$workingPath = Get-Location

#Display current location in a message box
[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
[System.Windows.Forms.MessageBox]::Show($workingPath)

This is the complete configuration:

Powershell build event