Terminal: Build fails with spaces in user directory

Created on 7 May 2019  Â·  12Comments  Â·  Source: microsoft/terminal

  • Your Windows build number: 10.0.17763.437

  • What you're doing and what's happening:
    Trying to build using VS 2017 Enterprise, the build fails like this:

24>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(128,5): error MSB3073: Der Befehl "
24>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(128,5): error MSB3073:         if not exist C:\Users\Fridtjof Mund\git\Terminal\x64\Debug\WindowsTerminal mkdir C:\Users\Fridtjof Mund\git\Terminal\x64\Debug\WindowsTerminal
24>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(128,5): error MSB3073:       
24>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(128,5): error MSB3073: :VCEnd" wurde mit dem Code 3 beendet.

I suspect this is because of the space in my user folder. This also breaks razzle.cmd

Area-Build Help Wanted Issue-Bug

Most helpful comment

IMHO, It's so fascinating to see Windows people got interested by a new Terminal. Looks like 25 years ago with a fedora 2.

All 12 comments

IMHO, It's so fascinating to see Windows people got interested by a new Terminal. Looks like 25 years ago with a fedora 2.

Same here (really annoying this kind of issues still exists).

Yep, this is a real bug. Should've escaped that commandline with quotes. I believe the bug is in one of the .props files, but I can't be sure which one.

If someone wanted to dig into this and properly escape the commands in question, I'd happily review the PR :)

Or, replace the commands with real MSBuild rules!


From: Mike Griese notifications@github.com
Sent: Wednesday, May 8, 2019 12:29:06 PM
To: microsoft/Terminal
Cc: Subscribed
Subject: Re: [microsoft/Terminal] Build fails with spaces in user directory (#438)

If someone wanted to dig into this and properly escape the commands in question, I'd happily review the PR :)

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTerminal%2Fissues%2F438%23issuecomment-490618915&data=01%7C01%7Cduhowett%40microsoft.com%7C5b0d4d0a981240f8773e08d6d3eb6fd6%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=vSCHR9xkU%2FscVbvNh7vhpGF%2BBHRL5b1T9IoBFECTNFM%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FADNHLGR3C4NPDNUIKXVGUB3PUMSYFANCNFSM4HLD5M2A&data=01%7C01%7Cduhowett%40microsoft.com%7C5b0d4d0a981240f8773e08d6d3eb6fd6%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=KvSG%2FW8ibHUDXdhVdC5u8mohLWbrpQ0cl6p1Ts8i%2BQc%3D&reserved=0.

Files of note in regards to fixing directories not being quoted in commands (either by quotation marks or " as necessary):

  • src\host\ft_uia\Host.Tests.UIA.csproj
  • src\cppwinrt.build.post.props
  • src\propsheet\propsheet.vcxproj (I inserted a period character after the output path variables to force a period before the ending slash so that mc.exe was happy)

I am able to successfully build the CascadiaPackage project on x64 release after these changes.

1) src\host\ft_uia\Host.Tests.UIA.csproj (added " entities):

  <PropertyGroup>
    <PostBuildEvent>copy &quot;$(SolutionDir)\dep\WinAppDriver\*&quot; &quot;$(OutDir)&quot;\</PostBuildEvent>
  </PropertyGroup>

2) src\propsheet\propsheet.vcxproj (added " entities to mc.exe arguments AND added a . to $(IntermediateOutputPath) because the project uses a .dll suffix):

  <Target Name="MessageCompile" Inputs="@(MessageCompile)" Outputs="$(IntermediateOutputPath)\%(MessageCompile.Filename).h" BeforeTargets="ClCompile">
    <Exec Command="mc.exe /h &quot;$(IntermediateOutputPath).&quot; /r &quot;$(IntermediateOutputPath).&quot; @(MessageCompile)" />
  </Target>

3) src\cppwinrt.build.post.props (added " entities to xcopy arguments):

  <ItemDefinitionGroup Condition="'$(NoOutputRedirection)'=='true' And '$(ConfigurationType)'=='DynamicLibrary' And '$(DontCopyOutput)'!='true'">
    <PostBuildEvent Condition="'$(Platform)'!='Win32'">
      <Command>
        echo OutDir=$(OutDir)
        (echo f | xcopy /y &quot;$(OutDir)$(ProjectName).dll&quot; &quot;$(OpenConsoleDir)$(Platform)\$(Configuration)\$(ProjectName).dll&quot; )
        (echo f | xcopy /y &quot;$(OutDir)$(ProjectName).pdb&quot; &quot;$(OpenConsoleDir)$(Platform)\$(Configuration)\$(ProjectName).pdb&quot; )
      </Command>
    </PostBuildEvent>
    <PostBuildEvent Condition="'$(Platform)'=='Win32'">
      <Command>
        echo OutDir=$(OutDir)
        (echo f | xcopy /y &quot;$(OutDir)$(ProjectName).dll&quot; &quot;$(OpenConsoleDir)$(Configuration)\$(ProjectName).dll&quot; )
        (echo f | xcopy /y &quot;$(OutDir)$(ProjectName).pdb&quot; &quot;$(OpenConsoleDir)$(Configuration)\$(ProjectName).pdb&quot; )
      </Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>

4) tools\razzle.cmd (added "):

rem call .razzlerc - for your generic razzle environment stuff
if exist "%OPENCON_TOOLS%\.razzlerc.cmd" (
    call "%OPENCON_TOOLS%\.razzlerc.cmd"
)   else (
    (
        echo @echo off
        echo.
        echo rem This is your razzlerc file. It can be used for default dev environment setup.
    ) > "%OPENCON_TOOLS%\.razzlerc.cmd"
)

5) tools\opencon.cmd (added plain quotes):

if not exist "%OPENCON%\bin\%ARCH%\%_LAST_BUILD_CONF%\OpenConsole.exe" (
    echo Could not locate the OpenConsole.exe in "%OPENCON%\bin\%ARCH%\%_LAST_BUILD_CONF%". Double check that it has been built and try again.
    goto :eof
)

and

(echo f | xcopy /Y "%_last_build%\OpenConsole.exe" %TEMP%\%copy_dir%\OpenConsole.exe) > nul
(echo f | xcopy /Y "%_last_build%\OpenConsole.exe" %TEMP%\%copy_dir%\conhost.exe) > nul
(echo f | xcopy /Y "%_last_build%\VtPipeTerm.exe" %TEMP%\%copy_dir%\VtPipeTerm.exe) > nul
(echo f | xcopy /Y "%_last_build%\Nihilist.exe" %TEMP%\%copy_dir%\Nihilist.exe) > nul
(echo f | xcopy /Y "%_last_build%\console.dll" %TEMP%\%copy_dir%\console.dll) > nul

and counting...

One possible solution:
DON'T put the files under your user folder, or any sub directories from your user folder such as Documents, Downloads.
Even USB drives work fine.

To be fair, that's a workaround, not a solution.

One possible solution:
DON'T put the files under your user folder, or any sub directories from your user folder such as Documents, Downloads.
Even USB drives work fine.

I tried doing this but still get the same Error

Edit:
Turns out the Language was the Problem for me because XCopy on german machines wants 'd' instead of 'f' as you can see in #507

There's still a problem in the post-compile commands.

Some paths are unquoted, i was able to fix it like this.

image
image

20>mc : error : 0x3 trying to open file <Uchiha\Documents\Terminal\\obj\x64\Release\Propsheet.DLL\>. 20>C:\Users\Itachi Uchiha\Documents\Terminal\src\propsheet\propsheet.vcxproj(81,5): error MSB3073: The command "mc.exe /h C:\Users\Itachi Uchiha\Documents\Terminal\\obj\x64\Release\Propsheet.DLL\ /r C:\Users\Itachi Uchiha\Documents\Terminal\\obj\x64\Release\Propsheet.DLL\ strid.mc" exited with code 1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carlos-zamora picture carlos-zamora  Â·  3Comments

ghvanderweg picture ghvanderweg  Â·  3Comments

mrmlnc picture mrmlnc  Â·  3Comments

mrmlnc picture mrmlnc  Â·  3Comments

miniksa picture miniksa  Â·  3Comments