Skip to content

Add ProjectBuildEvent

Apostolis Bekiaris edited this page Apr 22, 2020 · 1 revision

image

image


Star the project if you think it deserves it.

GitHub stars

Fork the project to extend and contribute.

GitHub forks

Clone this wiki locally

external help file: XpandPwsh-help.xml Module Name: XpandPwsh online version: schema: 2.0.0

Add-ProjectBuildEvent

SYNOPSIS

Adds MSBuild project build PostBuildEvent, PreBuildEvent.

SYNTAX

Add-ProjectBuildEvent [-EventName] <String> [-Project] <XmlDocument> [-InnerText] <String> [-Append]
 [<CommonParameters>]

DESCRIPTION

Adds MSBuild project build PostBuildEvent, PreBuildEvent.

EXAMPLES

Example 1

PS C:\> $linkText=@"
if exist `"`$(MSBuildProjectDirectory)\bin`" rmdir `"`$(MSBuildProjectDirectory)\bin`"
mklink /J `"`$(MSBuildProjectDirectory)\bin" "`$(MSBuildProjectDirectory)\`$(OutputPath)`"
"@
$postBuildEvent=$CSProj.project.PropertyGroup.PostBuildEvent|Where-Object{$_}
if (($postBuildEvent|Where-Object{
    $_ -notlike "*nmklink*"
})){
    Add-ProjectBuildEvent PostBuildEvent $CSProj -InnerText $linkText -Append
}

Creates a junction pointing to the MSBuild project output path. Used from the Update-OutputPath CmdLet.

PARAMETERS

-Append

{{ Fill Append Description }}

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-EventName

{{ Fill EventName Description }}

Type: String
Parameter Sets: (All)
Aliases:
Accepted values: PostBuildEvent, PreBuildEvent

Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-InnerText

{{ Fill InnerText Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Project

{{ Fill Project Description }}

Type: XmlDocument
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

System.Object

NOTES

RELATED LINKS