microsoft / terminal

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

Please update building documentation #17880

Open AlexeiNaabal opened 2 months ago

AlexeiNaabal commented 2 months ago

We followed the building section of README.md and doc/building.md to build the terminal, and found several uncleared guidance.

Following the guidance, we expect:

  1. git submodule command initialize 3rd party codebase
  2. OpenConsole.sln restore successfully when launching the CascadiaPackage with the documented setup

While the actual behavior is:

  1. .gitmodule present nowhere, thus the git command does nothing
  2. Several nuget error with "Unable to find", such as
    NU1101  Unable to find package Microsoft.AspNetCore.App.Ref. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, TerminalDependencies   TerminalStress  G:\GithubRepos\terminal\src\tools\TerminalStress\TerminalStress.csproj  1       
    NU1101  Unable to find package Microsoft.NETCore.App.Ref. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, TerminalDependencies  TerminalStress  G:\GithubRepos\terminal\src\tools\TerminalStress\TerminalStress.csproj  1       
    NU1101  Unable to find package Microsoft.WindowsDesktop.App.Ref. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, TerminalDependencies   TerminalStress  G:\GithubRepos\terminal\src\tools\TerminalStress\TerminalStress.csproj  1       
  3. Several nuget restore error with site pkgs.dev.azure.com/shine-oss, reason is 401, Unauthorized

Please update the building documentation

shuffle2 commented 1 day ago

+1 for this...

Some steps I just went through:

  1. git clean -dfx (as I only build the project infrequently, and some stuff was using old intermediate files and breaking)
  2. Import-Module .\tools\OpenConsole.psm1 must be run with powershell 7
  3. Invoke-OpenConsoleBuild fails because console-driven build does not detect vcpkg itself is missing.
  4. As previously noted, there are no gitmodules (anymore?)
  5. The cmd.exe based bcz build flow must be run in VS dev environment (ie after running vcvarsall), and also doesn't handle vcpkg missing.
  6. Opening the sln in VS, you'll be greated with the nice Image. This installs vcpkg and whatever else. In my case: Image.

After letting VS install stuff, bcz still does not work, because of the nuget issue listed above. Invoke-OpenConsoleBuild does work, as that does trigger nuget restore.

Another thing of note is that both msbuild and VS complain that the sln isn't properly formatted, with an error like:

Error parsing solution file at c:\src\terminal\OpenConsole.sln: Exception has been thrown by the target of an invocation.

(although it's ignorable and iirc has been happening for a long time).

You should probably suggest to pass -m to Invoke-OpenConsoleBuild, as otherwise build is incredibly slow. Additionally, -p:Configuration=Release,Platform=x64.

So the final line is Invoke-OpenConsoleBuild -m "-p:Configuration=Release,Platform=x64"

Since Invoke-OpenConsoleBuild hardcodes use of sln, it's not currently possible to specify which individual project to build.