Skip to content

Build Issue: VS Code Tasks require quoting around paths possibly containing spaces. #10199

@msftrncs

Description

@msftrncs

Attempting to run the 'Build' Task in VS Code and I get an error:

Import-Module : A positional parameter cannot be found that accepts argument 'Repositories\PowerShell/build.psm1'.
At line:1 char:1
+ Import-Module C:\Users\Carl\Documents\Git Repositories\PowerShell/bui ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Import-Module], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

The reason is a lack of quoting around the pathname arguments in the Tasks.JSON file, where they could contain spaces. I corrected, and building at least started.

    "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 -Output (Join-Path '${workspaceFolder}' debug)",
            "problemMatcher": "$msCompile"
        },
        {
            "label": "Build",
            "type": "shell",
            "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBuild -Output (Join-Path '${workspaceFolder}' debug)",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": "$msCompile"
        }
    ]

Now I am trying to figure out why the build failed at:

C:\Users\Carl\Documents\Git Repositories\PowerShell\src\System.Management.Automation\engine\remoting\commands\EnterPSHostProcessCommand.cs(135,72): error CS0117: 'RemotingErrorIdStrings' does not contain a definition for 'EnterPSHostProcessCmdletDisabled' [C:\Users\Carl\Documents\Git Repositories\PowerShell\src\System.Management.Automation\System.Management.Automation.csproj]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Maintainers-Buildspecific to affecting the buildIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions