Skip to content
rafd123 edited this page Nov 28, 2014 · 8 revisions

Installation

PowerBridge is available as a NuGet package. You can install it from Visual Studio's NuGet Package Manager UI, or from the package manager console:

PM> Install-Package PowerBridge

Doing so will:

  • Automatically import the necessary MSBuild gunk into your project file.
  • Adds the following scripts to your project file *
    • .BuildScripts\BeforeBuild.ps1
    • .BuildScripts\AfterBuild.ps1

* The build BeforeBuild.ps1 and AfterBuild.ps1 files are only added if:

  • They don't already exist
  • You haven't manually added the InvokePowerShell build task to your project, which was required prior to version 1.3.

Invoking PowerShell from within Your Project

Simply edit the .BuildScripts\BeforeBuild.ps1 and .BuildScripts\AfterBuild.ps1 to your liking.

If you don't need one, delete it.

Using MSBuild Properties in your PowerShell scripts

PowerBridge will automatically pass well-known Visual Studio and MSBuild build properties to BeforeBuild.ps1 and AfterBuild.ps1.

To leverage a build property, simply declare it as a script parameter. For example:

param
(
    # When the script is called, $ProjectDir will contain
    # the value of the MSBuild ProjectDir property
    $ProjectDir
)

# The rest of your script goes here.

To get a full list of MSBuild properties that PowerBridge supports, see:

Clone this wiki locally