microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.75k stars 8.33k forks source link

Building Terminal from the main branch says it can't find nugget.exe #16379

Open nivowski opened 11 months ago

nivowski commented 11 months ago

Windows Terminal version

1.18.3181.0

Windows build number

10.0.19045.0

Other Software

No response

Steps to reproduce

PS C:\Users\vinny\Documents\programming\projet_tutoré\terminal> Import-Module .\tools\OpenConsole.psm1 PS C:\Users\vinny\Documents\programming\projet_tutoré\terminal> Set-MsBuildDevEnvironment Dev environment variables set PS C:\Users\vinny\Documents\programming\projet_tutoré\terminal> Invoke-OpenConsoleBuild &: The term 'C:/Users/vinny/Documents/programming/projet_tutor├⌐/terminal\dep\nuget\nuget.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. &: The term 'C:/Users/vinny/Documents/programming/projet_tutor├⌐/terminal\dep\nuget\nuget.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. MSBuild version 17.8.3+195e7f5a3 for .NET Framework MSBUILD : error MSB1009: Project file does not exist. Switch: C:/Users/vinny/Documents/programming/projet_tutor├⌐/terminal\OpenConsole.sln

Expected Behavior

No response

Actual Behavior

The build process as described in the developer documentation is not working as it says the nugget.exe package is missing

zadjii-msft commented 11 months ago

Very curious error message there - does it work if you put the Terminal source in a directory that doesn't have an accented character like the é it's currently in?

The build script probably should be resilient to that sorta scenario, but that's my theory

nivowski commented 11 months ago

Very curious error message there - does it work if you put the Terminal source in a directory that doesn't have an accented character like the é it's currently in?

The build script probably should be resilient to that sorta scenario, but that's my theory

You were right, the build script doesn't include accented character to work. I replaced with a simple "e" without accent and it's actually building but is it normal that it takes a lot of time to build? I've been waiting for like 20+ minutes.

nivowski commented 11 months ago

Edit: It finally finished building however the building failed with 5 errors:

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targe ts(5198,5): error MSB3030: Could not copy the file "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\too ls\TerminalStress\obj\Debug\net6.0\apphost.exe" because it was not found. [C:\Users\vinny\Documents\programming\projet_ tutore\terminal\src\tools\TerminalStress\TerminalStress.csproj] Done Building Project "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\tools\TerminalStress\TerminalStr ess.csproj" (default targets) -- FAILED. Done Building Project "C:\Users\vinny\Documents\programming\projet_tutore\terminal\OpenConsole.sln" (default targets) - - FAILED. Build FAILED. "C:\Users\vinny\Documents\programming\projet_tutore\terminal\OpenConsole.sln" (default target) (1) -> "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\cascadia\CascadiaPackage\CascadiaPackage.wapproj.metap roj" (default target) (2) -> "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\cascadia\ShellExtension\WindowsTerminalShellExt.vcxpro j" (default target) (3) -> (ClCompile target) -> C:\Users\vinny\Documents\programming\projet_tutore\terminal\packages\Microsoft.Windows.ImplementationLibrary.1.0.2308 24.2\include\wil\cppwinrt.h(91,1): error C1083: Cannot open include file: 'winrt/base.h': No such file or directory [C: \Users\vinny\Documents\programming\projet_tutore\terminal\src\cascadia\ShellExtension\WindowsTerminalShellExt.vcxproj] "C:\Users\vinny\Documents\programming\projet_tutore\terminal\OpenConsole.sln" (default target) (1) -> "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\host\exe\Host.EXE.vcxproj.metaproj" (default target) ( 8) -> "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\host\exe\Host.EXE.vcxproj" (default target) (14) -> (ManifestResourceCompile target) -> C:\Users\vinny\Documents\programming\projet_tutore\terminal\obj\x64\Debug\Host.EXE\OpenConsole_manifest.rc(1): error RC2135: file not found: C:\Users\vinny\Documents\programming\projet_tutorΘ\terminal\obj\x64\Debug\Host.EXE\OpenConsole. exe.embed.manifest [C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\host\exe\Host.EXE.vcxproj] "C:\Users\vinny\Documents\programming\projet_tutore\terminal\OpenConsole.sln" (default target) (1) -> "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\cascadia\WpfTerminalControl\WpfTerminalControl.csproj" (default target) (84) -> "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\cascadia\WpfTerminalControl\WpfTerminalControl.csproj" (Build target) (84:2) -> (ResolvePackageAssets target) -> C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266, 5): error NETSDK1064: Package StyleCop.Analyzers, version 1.1.118 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path lengt h restrictions. [C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\cascadia\WpfTerminalControl\WpfTermina lControl.csproj::TargetFramework=net472] "C:\Users\vinny\Documents\programming\projet_tutore\terminal\OpenConsole.sln" (default target) (1) -> "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\cascadia\WpfTerminalControl\WpfTerminalControl.csproj" (default target) (84) -> "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\cascadia\WpfTerminalControl\WpfTerminalControl.csproj" (Build target) (84:3) -> C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266, 5): error NETSDK1064: Package StyleCop.Analyzers, version 1.1.118 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path lengt h restrictions. [C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\cascadia\WpfTerminalControl\WpfTermina lControl.csproj::TargetFramework=net6.0-windows] "C:\Users\vinny\Documents\programming\projet_tutore\terminal\OpenConsole.sln" (default target) (1) -> "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\tools\TerminalStress\TerminalStress.csproj" (default t arget) (114) -> (_CopyOutOfDateSourceItemsToOutputDirectory target) -> C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.tar gets(5198,5): error MSB3030: Could not copy the file "C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\t ools\TerminalStress\obj\Debug\net6.0\apphost.exe" because it was not found. [C:\Users\vinny\Documents\programming\proje t_tutore\terminal\src\tools\TerminalStress\TerminalStress.csproj] 6 Warning(s) 5 Error(s) Time Elapsed 00:22:38.29

lhecker commented 11 months ago

[...] but is it normal that it takes a lot of time to build? I've been waiting for like 20+ minutes.

Yes, unfortunately cppwinrt is very slow to compile. There are ways to speed it up (by sharing the PCH file), but we haven't had time yet to figure out how to make it work.

C:\Users\vinny\Documents\programming\projet_tutore\terminal\obj\x64\Debug\Host.EXE\OpenConsole_manifest.rc(1): error  RC2135: file not found:
C:\Users\vinny\Documents\programming\projet_tutorΘ\terminal\obj\x64\Debug\Host.EXE\OpenConsole.exe.embed.manifest [C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\host\exe\Host.EXE.vcxproj]    

While I'm not entirely sure why your build failed, the difference between tutore and tutorΘ worries me. I think your build cache is broken. I usually resolve that by rebuilding everything from scratch, but it also doesn't take 20min for me...

nivowski commented 11 months ago

[...] but is it normal that it takes a lot of time to build? I've been waiting for like 20+ minutes.

Yes, unfortunately cppwinrt is very slow to compile. There are ways to speed it up (by sharing the PCH file), but we haven't had time yet to figure out how to make it work.

C:\Users\vinny\Documents\programming\projet_tutore\terminal\obj\x64\Debug\Host.EXE\OpenConsole_manifest.rc(1): error  RC2135: file not found:
C:\Users\vinny\Documents\programming\projet_tutorΘ\terminal\obj\x64\Debug\Host.EXE\OpenConsole.exe.embed.manifest [C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\host\exe\Host.EXE.vcxproj]    

While I'm not entirely sure why your build failed, the difference between tutore and tutorΘ worries me. I think your build cache is broken. I usually resolve that by rebuilding everything from scratch, but it also doesn't take 20min for me...

How to clean building cache before doing again the build process? Is there an argument to pass to the "Invoke-OpenConsoleBuild" command?

nivowski commented 11 months ago

[...] but is it normal that it takes a lot of time to build? I've been waiting for like 20+ minutes.

Yes, unfortunately cppwinrt is very slow to compile. There are ways to speed it up (by sharing the PCH file), but we haven't had time yet to figure out how to make it work.

C:\Users\vinny\Documents\programming\projet_tutore\terminal\obj\x64\Debug\Host.EXE\OpenConsole_manifest.rc(1): error  RC2135: file not found:
C:\Users\vinny\Documents\programming\projet_tutorΘ\terminal\obj\x64\Debug\Host.EXE\OpenConsole.exe.embed.manifest [C:\Users\vinny\Documents\programming\projet_tutore\terminal\src\host\exe\Host.EXE.vcxproj]    

While I'm not entirely sure why your build failed, the difference between tutore and tutorΘ worries me. I think your build cache is broken. I usually resolve that by rebuilding everything from scratch, but it also doesn't take 20min for me...

How to clean building cache before doing again the build process? Is there an argument to pass to the "Invoke-OpenConsoleBuild" command?

I solved my build issue as suggested in https://learn.microsoft.com/en-us/nuget/consume-packages/package-restore by doing msbuild t:restore .\OpenConsole.sln and then Invoke-OpenConsoleBuild (msbuild .\OpenConsole.sln should work aswell).

zadjii-msft commented 11 months ago

This is almost certainly the root cause:

https://github.com/microsoft/terminal/blob/3b5e5cf5f121395b3cacdcb60c3208488c4bd259/tools/OpenConsole.psm1#L7-L14

PowerShell parses it in the ACP, which explodes here

nivowski commented 10 months ago

This is almost certainly the root cause:

https://github.com/microsoft/terminal/blob/3b5e5cf5f121395b3cacdcb60c3208488c4bd259/tools/OpenConsole.psm1#L7-L14

PowerShell parses it in the ACP, which explodes here

I don't really understand what's wrong in the code you showed as I debugged the script by printing different output to ensure everything is fine. My supposition tells me that it's certainly the nuget cause when invoking the Invoke-OpenConsoleBuild() as with running msbuild t:restore, the build appears to be success(packages missing and not retrieved with nuget?):

https://github.com/microsoft/terminal/blob/3b5e5cf5f121395b3cacdcb60c3208488c4bd259/tools/OpenConsole.psm1#L260-L266

nivowski commented 10 months ago

This is almost certainly the root cause: https://github.com/microsoft/terminal/blob/3b5e5cf5f121395b3cacdcb60c3208488c4bd259/tools/OpenConsole.psm1#L7-L14

PowerShell parses it in the ACP, which explodes here

I don't really understand what's wrong in the code you showed as I debugged the script by printing different output to ensure everything is fine. My supposition tells me that it's certainly the nuget cause when invoking the Invoke-OpenConsoleBuild() as with running msbuild t:restore, the build appears to be success(packages missing and not retrieved with nuget?):

https://github.com/microsoft/terminal/blob/3b5e5cf5f121395b3cacdcb60c3208488c4bd259/tools/OpenConsole.psm1#L260-L266

Update:

I actually downloaded the latest nuget executable from the official website and replaced the one used on this project and the error about "Exception thrown" disappeared. Can I have my hands on this issue to fix this bug? Thank you in advance.