Improve VS Code build current project support#43682
Conversation
This makes the following changes to our ability to build the current project from VSCode (essentially implementing the rough equivalent of build current project in VS). - Ability to choose `msbuild` in addition to `dotnet msbuild`. The full framework `msbuild` is still necessary for building parts of the IDE code base. - Support for VB projects - Fixes the execution of the task on Windows. The hard dependency on `/.dotnet` existing doesn't hold on Windows. Falling back to normal powershell in that environment
|
@333fred @RikkiGibson PTAL. I'm fairly confident I maintained the non-windows behavior for these tasks but would appreciate if you all could validate this. I have validated these changes work correctly on windows for both the |
| } | ||
|
|
||
| function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string]$logFileName = "", [switch]$parallel = $true, [switch]$summary = $true, [switch]$warnAsError = $true, [string]$configuration = $script:configuration) { | ||
| function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string]$logFileName = "", [switch]$parallel = $true, [switch]$summary = $true, [switch]$warnAsError = $true, [string]$configuration = $script:configuration, [switch]$skipAnalyzers = $false) { |
There was a problem hiding this comment.
This function was relying on $skipAnalyzers being implicitly defined. That seemed dangerous so I had it be passed as an explicit argument and fixed up the callers to use this.
| param ( | ||
| [Parameter(Mandatory = $true)][string]$filePath | ||
| [Parameter(Mandatory = $true)][string]$filePath, | ||
| [string]$msbuildEngine = "vs" |
There was a problem hiding this comment.
This parameter effectively acts like a global variable here. The implementation of InitializeBuildTool below relies on reading this variable to pick the appropriate build engine.
This pattern is how our core build.ps1 script works and I'm essentially replicating it here. That should make this script more resilient over time as it should evolve in sync with our core build logic.
There was a problem hiding this comment.
And InitializeBuildTool is in arcade and hard coded to dotnet.exe :(
Co-Authored-By: Rikki Gibson <rikkigibson@gmail.com>
| $invocation = "$dotnetPath msbuild $projectDir -p:UseRoslynAnalyzers=false -p:GenerateFullPaths=true" | ||
| Write-Output "> $invocation" | ||
| Invoke-Expression $invocation | ||
| $buildTool = InitializeBuildTool |
There was a problem hiding this comment.
Remember when I approved this? Yeah, that was a mistake.
This makes the following changes to our ability to build the current
project from VSCode (essentially implementing the rough equivalent of
build current project in VS).
msbuildin addition todotnet msbuild. The fullframework
msbuildis still necessary for building parts of the IDEcode base.
/.dotnetexisting doesn't hold on Windows. Falling back to normalpowershell in that environment