A PowerShell module to help with developing locally using MSBuild.
Table of Contents
To make development simpler in PowerShell using MSBuild this module wraps the commands and defaults to the binary logger which provides far better log output for looking at builds.
To get a local copy up and running follow these simple example steps.
- PowerShell Core 7.x+
To install this module to use you have three options
- Download the zip and extract to a local modules directory
- Install from the PowerShell Gallery
# To install for the first time.
Install-Module -Name DevOpsCommands -Scope CurrentUser
# To update if already installed
Update-Module -Name DevOpsCommands -Scope CurrentUser
To run with defaults just use the msb
alias at the root of your project. This will run MSBuild with binary logging enabled and will produce a x64 Debug build.
If you want to override the default settings put these variables at the end of your profile with the values you want to use. If you are happy with these defaults do not worry about them.
Setting | Value | Description |
---|---|---|
StructuredLogViewerPath | "$env:\AppData\Local\MSBuildStructuredLogViewer\app-2.1.88\StructuredLogViewer.exe" | Viewer for the Binary log produced by MSBuild |
MsBuildArguments | '/noLogo', '/m', '/nr:false', '/p:TreatWarningsAsErrors="true"', '/p:Platform="x64"' | Arguments passed to MSBuild on every execution |
VsDefault | 17 | Version of Visual Studio to import the console settings from |
Settings are controlled by the SimpleSettings commands, this is a dependency of this module. To update the default you can use commands like below with your values.
Set-SimpleSetting -Name "StructuredLogViewerPath" -Section "DevOpsCommands" -Value "$env:USERPROFILE\AppData\Local\MSBuildStructuredLogViewer\app-2.0.64\StructuredLogViewer.exe"
Set-SimpleSetting -Name "MsBuildArguments" -Section "DevOpsCommands" -Value @('/noLogo', '/m', '/nr:false', '/p:TreatWarningsAsErrors="true"', '/p:Platform="x64"')
# 15 == VS 2017
# 16 == VS 2019
# 17 == VS 2022
Set-SimpleSetting -Name "VsDefault" -Section "DevOpsCommands" -Value "17"
To list commands run Get-Command -Module DevOpsCommands
To get help on commands run Get-Command -Module DevOpsCommands | Get-Help
See the open issues for a list of proposed features (and known issues).
This project uses PSake for build automation. The build tasks are defined in psakefile.ps1
and provide a modular, dependency-driven build pipeline.
- PowerShell 5.1 or PowerShell Core 6+
- PSake module:
Install-Module PSake -Scope CurrentUser
- Pester module (for testing):
Install-Module Pester -Scope CurrentUser
- PlatyPS module (for documentation):
Install-Module PlatyPS -Scope CurrentUser
You can run PSake tasks using: Invoke-PSake psakefile.ps1 -taskList <TaskName>
Primary Tasks:
Default
- Runs the Build task (default when no task specified)Build
- Complete build process (validate → update version → update manifest → generate docs → package)Test
- Run build and all testsPublish
- Full pipeline with publishing to PowerShell GalleryClean
- Clean all build artifactsFullBuild
- Complete pipeline (clean → build → test)
Individual Tasks:
ValidateManifest
- Validate the module manifestUpdateVersion
- Update version informationUpdateManifest
- Update the module manifest with current functionsGenerateDocumentation
- Generate markdown and XML help filesRunTests
- Execute Pester testsPackageModule
- Package module for publishing
# Quick build and test
Invoke-PSake psakefile.ps1 -taskList Test
# Clean build from scratch
Invoke-PSake psakefile.ps1 -taskList FullBuild
# Build with specific version
Invoke-PSake psakefile.ps1 -taskList Build -properties @{"SemVer"="1.4.0"}
# Publish to PowerShell Gallery (requires API key setup)
Invoke-PSake psakefile.ps1 -taskList Publish -properties @{"Publish"=$true}
# Show all available tasks
Invoke-PSake psakefile.ps1 -taskList ShowHelp
The project includes VS Code tasks that integrate with the PSake build system:
- Ctrl+Shift+P → Tasks: Run Task → Build (or use Ctrl+Shift+B)
- Ctrl+Shift+P → Tasks: Run Task → Test (or use Ctrl+Shift+T)
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) Note: Use Conventional Commits format for the commit/Pull Request - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU GPLv3 License. See LICENSE
for more information.
Project Link: https://github.com/sytone/devopscommands