Conversation
There was a problem hiding this comment.
The whole RCEdit work is in if ($Environment.IsWindows) { block (see line 561), so no need to split the code path here.
There was a problem hiding this comment.
Yeah, forgot rcedit only applied to Windows, will fix
| $ReleaseVersion = (Get-PSCommitId) -replace '^v' | ||
| $fileVersion = $ReleaseVersion.Split("-")[0] | ||
| } | ||
| if (!$ReleaseVersion) { |
There was a problem hiding this comment.
Can you please add a comment about "In vscode, depending on where you started it from, it may not get the git commit id so it ends up empty. Add a default value to use."?
| $fileVersion = "6.0.0" | ||
| } | ||
|
|
||
| Write-Verbose "Release version: $ReleaseVersion" -Verbose |
There was a problem hiding this comment.
Please use log like rest of the file. I think it's better to make the message more specific on the RCEdit operation, like "Embed the icon resource to pwsh.exe, use release version: $ReleaseVersion"
There was a problem hiding this comment.
I'll just remove this, only needed it to figure out why it wasn't working
| Start-NativeExecution { & "~/.rcedit/rcedit-x64.exe" "$($Options.Output)" --set-icon "$PSScriptRoot\assets\Powershell_black.ico" ` | ||
| --set-file-version $ReleaseVersion --set-product-version $ReleaseVersion --set-version-string "ProductName" "PowerShell Core 6" ` | ||
| Start-NativeExecution { & "~/.rcedit/rcedit-x64.exe" $pwshPath --set-icon "$PSScriptRoot\assets\Powershell_black.ico" ` | ||
| --set-file-version $fileVersion --set-product-version $ReleaseVersion --set-version-string "ProductName" "PowerShell Core 6" ` |
There was a problem hiding this comment.
$fileVersion is not set when $ReleaseTagToUse exists.
|
You might want to try this tasks.json: {
"version": "2.0.0",
"windows": {
"options": {
"shell": {
"executable": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"args": [
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-Command"
]
}
}
},
"linux": {
"options": {
"shell": {
"executable": "/usr/bin/pwsh",
"args": [
"-NoProfile",
"-Command"
]
}
}
},
"osx": {
"options": {
"shell": {
"executable": "/usr/local/bin/pwsh",
"args": [
"-NoProfile",
"-Command"
]
}
}
},
"tasks": [
{
"label": "Bootstrap",
"type": "shell",
"command": "Import-Module ${workspaceFolder}/build.psm1; Start-PSBootstrap",
"problemMatcher": []
},
{
"label": "Clean Build",
"type": "shell",
"command": "Import-Module ${workspaceFolder}/build.psm1; Start-PSBuild -Clean",
"problemMatcher": []
},
{
"label": "Build",
"type": "shell",
"command": "Import-Module ${workspaceFolder}/build.psm1; Start-PSBuild -Output ${workspaceFolder}/debug",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile"
},
{
"label": "Test",
"type": "shell",
"command": "Import-Module ${workspaceFolder}/build.psm1; Start-PSPester -Path ${workspaceFolder}/test -Tag CI",
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": "$pester"
}
]
}There seems to be an issue with the Also, I wonder if we should specify a tag for testing within VSCode - perhaps I can submit this as a PR if you'd like or if you just want to take it and run - that's fine too. |
|
I'll add a slightly modified version of @rkeithhill 's tasks.json. Thanks for that! |
added v2.0.0 tasks.json thanks to Keith Hill
| "label": "Clean Build", | ||
| "type": "shell", | ||
| "command": "Import-Module ${workspaceFolder}/build.psm1; Start-PSBuild -Clean", | ||
| "problemMatcher": [] |
There was a problem hiding this comment.
Doh! I forgot to put the $msCompile problem matcher here. I could be wrong about this but Start-PSBuild -Clean doesn't just clean. It cleans first and then builds, right?
| { | ||
| "label": "Test", | ||
| "type": "shell", | ||
| "command": "Import-Module ${workspaceFolder}/build.psm1; Start-PSPester -Path ${workspaceFolder}/test", |
There was a problem hiding this comment.
You should consider adding the -Tag CI parameter here. Running VSCode as admin is not something most folks do and if you run these tests not elevated, you get a lot of failures. You could also add two tasks - one that does a full test run and another that tests just the CI tests.
There was a problem hiding this comment.
Actually, I think I'll remove this task as intent is people run CI + Feature (which is default), but you are right that the tests expect user to be elevated and, in general, shouldn't be running vscode elevated.
15b6e48 to
c1f0bea
Compare
|
@rkeithhill to answer some of your questions:
|
| } | ||
| ] | ||
| } | ||
| } No newline at end of file |
iSazonov
left a comment
There was a problem hiding this comment.
@SteveL-MSFT @rkeithhill Thanks for the great PR!
| { | ||
| "label": "Build", | ||
| "type": "shell", | ||
| "command": "Import-Module ${workspaceFolder}/build.psm1; Start-PSBuild -Output (Join-Path ${workspaceFolder} debug)", |
There was a problem hiding this comment.
Nice! Can you add the same parameter to the Clean Build task above? Also, Clean Build reads a little awkward. What if we called this task Rebuild? On VS at least, that implies Clean, then Build.
There was a problem hiding this comment.
BTW I was just going to warn you about this issue when I saw you not only already knew about it but solved it. 👍 Also, I tagged onto this VSCode issue on the $mscompile problem matcher not working - microsoft/vscode#34660
There was a problem hiding this comment.
Will add to Clean Build which I think is named fine
There was a problem hiding this comment.
@SteveL-MSFT I got a response from the VSCode team on the $mscompile issue. All we need to do is add the command line arg - /property:GenerateFullPaths=true. I tried putting this around line 485:
$Arguments += "/property:GenerateFullPaths=true"
And it works! There may be other places where this arg needs to be provided.

There were several issues:
In vscode, depending on where you started it from, it may not get the git commit id so it ends up empty. Add a default value to use.
From the console, the commit id was typically in a form that is not parse-able as a fileversion. Fix is to chop off everything right of the dash.
It also seems that building from the console and building from vscode, the output path may or may not include
pwsh, however, rcedit needs the actual executable in the path.Fix #5440