< Back

Invoke-MsBuild

Wed Jan 15, 2020 4:48 am

NAME Invoke-MsBuild



SYNOPSIS

Builds the given Visual Studio solution or project file using MsBuild.





SYNTAX

Invoke-MsBuild [-Path] <String> [-MsBuildParameters <String>] [-Use32BitMsBuild] [-BuildLogDirectoryPath <String>]

[-LogVerbosityLevel <String>] [-AutoLaunchBuildLogOnFailure] [-AutoLaunchBuildErrorsLogOnFailure]

[-KeepBuildLogOnSuccessfulBuilds] [-ShowBuildOutputInNewWindow] [-ShowBuildOutputInCurrentWindow]

[-PromptForInputBeforeClosing] [-MsBuildFilePath <String>] [-VisualStudioDeveloperCommandPromptFilePath <String>]

[-BypassVisualStudioDeveloperCommandPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]



Invoke-MsBuild [-Path] <String> [-MsBuildParameters <String>] [-Use32BitMsBuild] [-BuildLogDirectoryPath <String>]

[-LogVerbosityLevel <String>] [-ShowBuildOutputInNewWindow] [-ShowBuildOutputInCurrentWindow] [-MsBuildFilePath

<String>] [-VisualStudioDeveloperCommandPromptFilePath <String>] [-BypassVisualStudioDeveloperCommandPrompt]

[-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

Executes the MsBuild.exe tool against the specified Visual Studio solution or project file.

Returns a hash table with properties for determining if the build succeeded or not, as well as other information

(see the OUTPUTS section for list of properties).

If using the PathThru switch, the process running MsBuild is returned instead.





PARAMETERS

-Path <String>

The path of the Visual Studio solution or project to build (e.g. a .sln or .csproj file).



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-MsBuildParameters <String>

Additional parameters to pass to the MsBuild command-line tool. This can be any valid MsBuild command-line

parameters except for the path of

the solution/project to build.



See http://msdn.microsoft.com/en-ca/library ... 64311.aspx for valid MsBuild command-line parameters.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Use32BitMsBuild [<SwitchParameter>]

If this switch is provided, the 32-bit version of MsBuild.exe will be used instead of the 64-bit version when

both are available.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-BuildLogDirectoryPath <String>

The directory path to write the build log files to.

Defaults to putting the log files in the users temp directory (e.g. C:\\Users\\[User Name]\\AppData\\Local\\Temp).

Use the keyword "PathDirectory" to put the log files in the same directory as the .sln or project file being

built.

Two log files are generated: one with the complete build log, and one that contains only errors from the build.



Required? false

Position? named

Default value $env:Temp

Accept pipeline input? false

Accept wildcard characters? false



-LogVerbosityLevel <String>



Required? false

Position? named

Default value normal

Accept pipeline input? false

Accept wildcard characters? false



-AutoLaunchBuildLogOnFailure [<SwitchParameter>]

If set, this switch will cause the build log to automatically be launched into the default viewer if the build

fails.

This log file contains all of the build output.

NOTE: This switch cannot be used with the PassThru switch.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-AutoLaunchBuildErrorsLogOnFailure [<SwitchParameter>]

If set, this switch will cause the build errors log to automatically be launched into the default viewer if

the build fails.

This log file only contains errors from the build output.

NOTE: This switch cannot be used with the PassThru switch.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-KeepBuildLogOnSuccessfulBuilds [<SwitchParameter>]

If set, this switch will cause the MsBuild log file to not be deleted on successful builds; normally it is

only kept around on failed builds.

NOTE: This switch cannot be used with the PassThru switch.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-ShowBuildOutputInNewWindow [<SwitchParameter>]

If set, this switch will cause a command prompt window to be shown in order to view the progress of the build.

By default the build output is not shown in any window.

NOTE: This switch cannot be used with the ShowBuildOutputInCurrentWindow switch.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-ShowBuildOutputInCurrentWindow [<SwitchParameter>]

If set, this switch will cause the build process to be started in the existing console window, instead of

creating a new one.

By default the build output is not shown in any window.

NOTE: This switch will override the ShowBuildOutputInNewWindow switch.

NOTE: There is a problem with the -NoNewWindow parameter of the Start-Process cmdlet; this is used for the

ShowBuildOutputInCurrentWindow switch.