Skip to content

build.cmd fails if path contains a space #42397

@verdie-g

Description

@verdie-g

My username is abc def and I get an error running build.cmd.

PS> .\build.cmd
  Determining projects to restore...
  Tool 'coverlet.console' (version '1.7.2') was restored. Available commands: coverlet
  Tool 'dotnet-reportgenerator-globaltool' (version '4.5.8') was restored. Available commands: reportgenerator
  Tool 'microsoft.dotnet.xharness.cli' (version '1.0.0-prerelease.20403.2') was restored. Available commands: xharness

  Restore was successful.
  All projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  Determining projects to restore...
  Restored C:\Users\abc def\Documents\dotnet-runtime\src\installer\pkg\projects\netcoreapp\pkg\legacy\Microsoft.NETCore.App.pkgproj (in 162 ms).
  1 of 2 projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  Determining projects to restore...
  Restored C:\Users\abc def\Documents\dotnet-runtime\src\installer\pkg\projects\netcoreapp\pkg\workaround\Microsoft.NETCore.App.pkgproj (in 43 ms).
  Determining projects to restore...
  All projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  System.Private.CoreLib -> C:\Users\abc def\Documents\dotnet-runtime\artifacts\bin\coreclr\Windows_NT.x64.Debug\IL\System.Private.CoreLib.dll
  BUILD: Starting Build at 20:07:06.52
  '""C:\Users\abc' is not recognized as an internal or external command,
  operable program or batch file.
C:\Users\abc def\Documents\dotnet-runtime\src\coreclr\runtime.proj(37,5): error MSB3073: The command ""C:\Users\abc def\Documents\dotnet-runtime\src\coreclr\build-runtime.cmd" -x64 -debug" exited with code 1.

Build FAILED.

C:\Users\abc def\Documents\dotnet-runtime\src\coreclr\runtime.proj(37,5): error MSB3073: The command ""C:\Users\abc def\Documents\dotnet-runtime\src\coreclr\build-runtime.cmd" -x64 -debug" exited with code 1.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:50.88
Build failed.
Some builds failed:
        Configuration: Debug, Architecture: x64

After removing the line @if not defined _echo @echo off in build-runtime.cmd and running the file I get the same error but with more details.

PS C:\Users\abc def\Documents\dotnet-runtime2> .\src\coreclr\build-runtime.cmd -x64 -release -enforcegpo
C:\Users\abc def\Documents\dotnet-runtime2>setlocal EnableDelayedExpansion EnableExtensions
C:\Users\abc def\Documents\dotnet-runtime2>set "__MsgPrefix=BUILD: "
C:\Users\abc def\Documents\dotnet-runtime2>echo BUILD: Starting Build at 20:11:03.01
BUILD: Starting Build at 20:11:03.01
C:\Users\abc def\Documents\dotnet-runtime2>set __ThisScriptFull="C:\Users\abc def\Documents\dotnet-runtime2\src\coreclr\build-runtime.cmd"
C:\Users\abc def\Documents\dotnet-runtime2>set __ThisScriptDir="C:\Users\abc def\Documents\dotnet-runtime2\src\coreclr\"
C:\Users\abc def\Documents\dotnet-runtime2>call ""C:\Users\abc def\Documents\dotnet-runtime2\src\coreclr\""\setup_vs_tools.cmd
'""C:\Users\abc' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\abc def\Documents\dotnet-runtime2>if NOT '1' == '0' goto ExitWithError
C:\Users\abc def\Documents\dotnet-runtime2>exit /b 1

It seems like there is an issue with quotes at the line call ""C:\Users\abc def\Documents\dotnet-runtime2\src\coreclr\""\setup_vs_tools.cmd.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions