Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an easy way to enable binlogs in VS #11375

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ msbuild.ProjectImports.zip
# Visual Studio 2015
.vs/

# If MSBUILDDEBUGENGINE=1 and no directory is specified then MSBuild_Logs/ will be the default
MSBuild_Logs/

# Visual Studio 2015 Pre-CTP6
*.sln.ide
*.ide/
Expand Down
20 changes: 19 additions & 1 deletion startvs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ Param(
[Parameter(
Mandatory=$false,
HelpMessage="If specified, Roslyn dependencies will be included in the Razor extension when deployed.")]
[Switch]$includeRoslynDeps
[Switch]$includeRoslynDeps,

[Parameter(
Mandatory=$false,
HelpMessage="If specified, bin logs will be enabled for VS. See https://github.com/dotnet/msbuild/blob/main/documentation/wiki/Providing-Binary-Logs.md#capturing-binary-logs-through-visual-studio .")]
[Switch]$captureBinLogs,

[Parameter(
Mandatory=$false,
HelpMessage="If captureBinLogs is specified, this determines the output folder for them. Ignored if captureBinLogs is false.")]
[string]$binLogFolder=$null
)

if ($solutionFile -eq "") {
Expand All @@ -39,6 +49,14 @@ $env:DOTNET_MULTILEVEL_LOOKUP = 0
# Put our local dotnet.exe on PATH first so Visual Studio knows which one to use
$env:PATH = $env:DOTNET_ROOT + ";" + $env:PATH

if ($captureBinLogs) {
$env:MSBUILDDEBUGENGINE = 1

if ($binLogFolder -ne $null) {
$env:MSBUILDDEBUGPATH=$binLogFolder
}
}

$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"

if ($chooseVS) {
Expand Down