microsoft / terminal

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

Guide for build and installation #489

Closed ZgblKylin closed 5 years ago

ZgblKylin commented 5 years ago

Tools needed

  1. VS2017 or higher with the following packages ("Workloads" tab in Visual Studio Installer) : 1.1 Desktop Development with C++. 1.2 Universal Windows Platform Development. 1.3 Windows 10 SDK (10.0.18362.0). 1.4 If you're running VS2019, you'll also need to install either v141 Toolset or v142 Toolset.
  2. Git command-line tool.
  3. Nuget.exe (Needed in build step 3, can be found in Terminal/dep/nuget).

Build Steps

  1. git clone this repository, not download .zip file.
  2. Run git submodule update --init --recursive in Terminal folder.
  3. Run nuget restore OpenConsole.sln (This step can be skipped, then Visual Studio should warn you that there are packages to restore - then restore).
  4. Open OpenConsole.sln with Visual Studio.
  5. Build whole solution(F7) with your platform(x86/x64) and release mode, you may need to fix some build errors: 5.1 C2220 and code page warnings: All errors and warnings are encoding error of unicode characters, a helpful workaround is to modify corresponding file encoding to UTF-8 BOM (Notepad++ is recommended). 5.2 Errors in src/tools/vtpipeterm/main.cpp: In addtion, you should also add u8 prefix before string literals with unicode characters, e.g. line 395, 398, 401 and 404.

Workaround

Try build with PR 458 or PR 549, both of them can build successfully.

Installation

Unfortunately, the generated .appx doesn't have any certificates, so it cannot be installed via double-click or powershell, the only way to install is to deploy the solution in VS.

  1. Open Windows Settings - Upgrade & Security - For Developers, switch App sources to Developer mode.
  2. Right click on CascadiaPackage project (under Solution/Terminal), select Deploy Solution to install, then you'll find Windows Terminal (Preview) in start menu.

Settings

After open the terminal, you can't see any menu buttons.

Just press Ctrl + T to open a new tab, and you'll see a drop-down button in the tab bar.

Click it and select Settings, then you can modify the configuration via opened profiles.json.

Add WSL

  1. Create a new session in profiles, with content copied from profiles/cmd.
  2. Give it a new guid.
  3. Give it a new name, such as WSL.
  4. Specify its commandline to wsl.exe.

Then you'll find WSL in the drop-down menu of tab bar.

Here're sample codes:

{
    "guid": "{09dc5eef-6840-4050-ae69-21e55e6a2e62}",
    "name": "WSL",
    "colorscheme": "Campbell",
    "historySize": 9001,
    "snapOnInput": true,
    "cursorColor": "#FFFFFF",
    "cursorShape": "bar",
    "commandline": "wsl.exe",
    "fontFace": "Consolas",
    "fontSize": 12,
    "acrylicOpacity": 0.75,
    "useAcrylic": true,
    "closeOnExit": false,
    "padding": "0, 0, 0, 0"
}
fredrikaverpil commented 5 years ago

I jotted down some notes on how to run the terminal (from scratch) with VS2019 here.

The main juice is here (installs requirements from commandline):

"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installershell.exe" modify --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" --passive --norestart --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.Universal --add Microsoft.VisualStudio.Component.Windows10SDK.18362 --add Microsoft.VisualStudio.ComponentGroup.UWP.Support --add Microsoft.Component.VC.Runtime.OSSupport --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --add Microsoft.VisualStudio.ComponentGroup.UWP.VC.v141 --add Microsoft.VisualStudio.Component.VC.v141.ATL --add Microsoft.VisualStudio.Component.VC.v141.MFC

The above command assumes the community edition. So if you are on another edition, double-check your paths. The workload/component IDs can be found here.

mehulmpt commented 5 years ago

Nevermind, I downgraded to VS2017 and it works like a charm now

snooopcatt commented 5 years ago

“wil/Common.h”: No such file or directory how is this error resolved???

I had similar issues because my file system was case-senstive. Converted it to non-sensitive and it went well

christian-korneck commented 5 years ago

and the filesystem needs to be NTFS (building the sources from an exFat volume didn't work for me)

snooopcatt commented 5 years ago

Here is a solution which I used to disable that recursively: https://stackoverflow.com/questions/51591091/apply-setcasesensitiveinfo-recursively-to-all-folders-and-subfolders

CaptainMorgans commented 5 years ago

“wil/Common.h”: No such file or directory how is this error resolved???

You should try cloning the repository again via git clone (not downloading the ZIP file). Then you run these two commands within the Terminal directory:

git submodule update --init --recursive

Then, change directory into dep/nuget

Then, run: > nuget restore OpenConsole.sln

TIP: you may also try >nuget restore (path to openconsole sln) if nuget isn't in your PATH (which it probably isn't). Just remember to be in the nuget directory.

Hope this helps!

Agreed, cloning the Git repository and then running the steps appears to have solved the “wil/Common.h”: No such file or directory once the command >> git submodule update --init --recursive has been run.

I used these steps: from @christian-korneck post above.

git clone https://github.com/microsoft/Terminal.git cd Terminal git submodule update --init --recursive nuget restore OpenConsole.sln

I still get other errors when trying to build / deploy . I am now going to try downgrading to VS2017 and try the build.

vsavic commented 5 years ago

One small hint for these who manage to build it (I managed only with VS2017).

Once deployed, in official doc says (...and also in one of the comments above) that will appear under: Windows Terminal (Preview) ...so if you search for this you won't find anything.

On my machine after I deployed it it's showing as: Windows Terminal (Dev Build)

Cheers

CaptainMorgans commented 5 years ago

I confirm that I also only managed to get it built with VS2017.

Can't wait to play with the code a bit and see what cool things we can come up with.

image

Meowv commented 5 years ago

1

nice

hasselrot commented 5 years ago

Would it be possible to have a tab for running pwsh.exe as administrator? How would such a configuration look like?

mKay00 commented 5 years ago

Would it be possible to have a tab for running pwsh.exe as administrator? How would such a configuration look like?

Not for now, see #691

BritishWerewolf commented 5 years ago

FWIW, I was having errors because I didn't have ATL support. This StackOverflow answer helped me out.

dantenull commented 5 years ago

“wil/Common.h”: No such file or directory how is this error resolved???

You should try cloning the repository again via git clone (not downloading the ZIP file). Then you run these two commands within the Terminal directory:

git submodule update --init --recursive

Then, change directory into dep/nuget

Then, run: > nuget restore OpenConsole.sln

TIP: you may also try >nuget restore (path to openconsole sln) if nuget isn't in your PATH (which it probably isn't). Just remember to be in the nuget directory.

Hope this helps!

Thank you very much! I made it.But there are other problems. 屏幕快照 2019-05-14 上午1 23 16

dantenull commented 5 years ago

“wil/Common.h”: No such file or directory how is this error resolved???

You should try cloning the repository again via git clone (not downloading the ZIP file). Then you run these two commands within the Terminal directory:

git submodule update --init --recursive

Then, change directory into dep/nuget Then, run: > nuget restore OpenConsole.sln TIP: you may also try >nuget restore (path to openconsole sln) if nuget isn't in your PATH (which it probably isn't). Just remember to be in the nuget directory. Hope this helps!

Agreed, cloning the Git repository and then running the steps appears to have solved the “wil/Common.h”: No such file or directory once the command >> git submodule update --init --recursive has been run.

I used these steps: from @christian-korneck post above.

git clone https://github.com/microsoft/Terminal.git cd Terminal git submodule update --init --recursive nuget restore OpenConsole.sln

I still get other errors when trying to build / deploy . I am now going to try downgrading to VS2017 and try the build.

Thank you very much! I made it.I forget to cd Terminal..But I have another problem and I have no idea.. 屏幕快照 2019-05-14 上午1 23 16

CaptainMorgans commented 5 years ago

This is really fun. The green glow is awesome.

Can't wait to really dive into the code and get some things working.

Next order of business is to change the tab labels to the profile name.

image

schuettecarsten commented 5 years ago

For me, building with VS2019 fails with:


C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Microsoft\DesktopBridge\Microsoft.DesktopBridge.targets(261,5):
error MSB3774: SDK "Microsoft.VCLibs.Desktop, Version=14.0" konnte nicht gefunden werden.
[d:\Projekte\Terminal\pkg\appx\OpenConsolePackage.wapproj]
hasselrot commented 5 years ago

@CaptainMorgans @Meowv I seem to have missed something, how did you get the icons working?

mKay00 commented 5 years ago

@hasselrot You have to copy image files into %LOCALAPPDATA%\packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState and use them in the profile.json

hasselrot commented 5 years ago

@mKay00 Excellent! What is the key used in profile.json?

drekryan commented 5 years ago

“wil/Common.h”: No such file or directory how is this error resolved???

You should try cloning the repository again via git clone (not downloading the ZIP file). Then you run these two commands within the Terminal directory:

git submodule update --init --recursive

Then, change directory into dep/nuget Then, run: > nuget restore OpenConsole.sln TIP: you may also try >nuget restore (path to openconsole sln) if nuget isn't in your PATH (which it probably isn't). Just remember to be in the nuget directory. Hope this helps!

Agreed, cloning the Git repository and then running the steps appears to have solved the “wil/Common.h”: No such file or directory once the command >> git submodule update --init --recursive has been run. I used these steps: from @christian-korneck post above. git clone https://github.com/microsoft/Terminal.git cd Terminal git submodule update --init --recursive nuget restore OpenConsole.sln I still get other errors when trying to build / deploy . I am now going to try downgrading to VS2017 and try the build.

Thank you very much! I made it.I forget to cd Terminal..But I have another problem and I have no idea.. 屏幕快照 2019-05-14 上午1 23 16

Hey I ran into this issue as well and resolved it by deleting any saved settings and allowing the app to regenerate them.

I went to the following location

%LOCALAPPDATA%\packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState may also be %LOCALAPPDATA%\packages\Microsoft.WindowsDevTerminal_8wekyb3d8bbwe\RoamingState

and deleted any profiles.json file located there and relaunched the app.

mKay00 commented 5 years ago

@hasselrot "icon" See the blog post of Scott Hanselman for a reference: https://www.hanselman.com/blog/ANewConsoleForWindowsItsTheOpenSourceWindowsTerminal.aspx

GeekRicardo commented 5 years ago

当我使用Git bash时,我被告知bash:nuget:command not found 如何解决它?

You should

When I used Git bash,I was told bash:nuget:command not found How to solve it?

You should use it in cmd

xpwn3rx commented 5 years ago

@christian-korneck Thank you for the steps. All worked up until the Deploy step.

========== Build: 21 succeeded, 4 failed, 0 up-to-date, 0 skipped ========== ========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

Errors below

Severity Code Description Project File Line Suppression State Error C1007 unrecognized flag '-Yu' in 'p2' TerminalControl C:\Terminal\src\cascadia\TerminalControl\LINK 1

Error LNK1257 code generation failed TerminalControl C:\Terminal\src\cascadia\TerminalControl\LINK 1

Error MIDL2011 [msg]unresolved type declaration [context]: Microsoft.Terminal.Settings.KeyChord [ Parameter 'chord' of Procedure 'SetKeyBinding' ( RuntimeClass 'TerminalApp.AppKeyBindings' ) ] TerminalApp C:\Terminal\src\cascadia\TerminalApp\AppKeyBindings.idl 62

Error MIDL2011 [msg]unresolved type declaration [context]: Microsoft.Terminal.Settings.IKeyBindings [ RuntimeClass 'TerminalApp.AppKeyBindings' ] TerminalApp C:\Terminal\src\cascadia\TerminalApp\AppKeyBindings.idl 59

Error C1083 Cannot open include file: 'winrt/TerminalApp.h': No such file or directory WindowsTerminal C:\Terminal\src\cascadia\WindowsTerminal\AppHost.h 7

Error C1083 Cannot open include file: 'winrt/TerminalApp.h': No such file or directory WindowsTerminal C:\Terminal\src\cascadia\WindowsTerminal\AppHost.h 7

Error C1083 Cannot open include file: 'winrt/TerminalApp.h': No such file or directory WindowsTerminal C:\Terminal\src\cascadia\WindowsTerminal\IslandWindow.h 7

Error C1083 Cannot open include file: 'winrt/TerminalApp.h': No such file or directory WindowsTerminal C:\Terminal\src\cascadia\WindowsTerminal\IslandWindow.h 7

Error Specified EntryPointExe 'WindowsTerminal.exe' was not found in the project outputs. CascadiaPackage C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\DesktopBridge\Microsoft.DesktopBridge.targets 413

image

I had these same problems. I was able to get this to build using VS2017 but I had to manually add the UWP C++ framework. I followed the instructions above with VS2017 and it worked.

miniksa commented 5 years ago

We expect a lot of this to get fixed by #565. Otherwise, the README has been updated a lot in the past few days with additional information. And there have been a lot of config odds and ends merged into master that have lit up functionality in VS2019 like automatically installing the dependent packages.

a1850524995 commented 5 years ago

我可以使用VS 2019构建它吗?

我恐怕你不能,我已经失败了23与VS2019建立......

Can I build it with VS 2019?

I'm afraid you can't, I have got 23 FAILED to build with VS2019...

I have been built with vs2019 sucessfully, in vs Installer,choose all v141 tools

csy19960309 commented 5 years ago

Can I build it with VS 2019?

Absolutely you can. If you update the tool sets and strictly follow the steps you can easily build the code successfully. I have no idea why someone failed

gottahavebling commented 5 years ago

I am trying to build using VS2017 and getting missing .h file error. How do I fix these?

Capture

gaohongkui commented 5 years ago

I want to know that I am now Windows10 1809 Build 17763.503, but I have not received the update file of Windows10 1903, how should I update it?I have successfully generated the terminal project, but there is no SDK for Win10 1903, so I cannot deploy and run the project.Who can help me?

MB7 QIQK819WQ2H%V4HP4WO

mKay00 commented 5 years ago

You have to be a Windows Insider. I think Release preview ring is enough. Go to Windows Settings, Update and Security and there is Windows Insider Program.

gaohongkui commented 5 years ago

You have to be a Windows Insider. I think Release preview ring is enough. Go to Windows Settings, Update and Security and there is Windows Insider Program.

That is failed! It is sad. image

mKay00 commented 5 years ago

I assume you have games installed on your PC? There are issues with anti-cheat software and thus it won't install, if you have anti cheat software installed. This workaround worked for me to install 1903, but I can't guarantee that you'll be able to play (all) online games after installing. I just moved the folder and moved it back after the update. https://twitter.com/zman982/status/1122049491140599808

gaohongkui commented 5 years ago

Yes,it works. Thanks a lot.

j-ae commented 5 years ago

image

I am trying to build using VS2019 and getting the namespace error.

https://docs.microsoft.com/en-us/uwp/api/microsoft.ui.xaml.controls?view=winui-2.1#classes From above the link, I tried to find the TabViewItem. There is no TabViewItem class.

Edit: I also checked "https://github.com/Microsoft/microsoft-ui-xaml". I installed "Microsoft.UI.Xaml.2.1.190405004.2". Maybe, it was on the old version(Microsoft.UI.Xaml.2.1.190405001-prerelease) but removed now?

l1005268416 commented 5 years ago

需要加入Windows预览体验计划,才能收到1903(insider)的推送。否则需要等到正式发布。

1005268416@qq.com

From: GodK Date: 2019-05-16 00:55 To: microsoft/terminal CC: l1005268416; Comment Subject: Re: [microsoft/terminal] Guide for build and installation (#489) 我想知道我现在是Windows10 1809 Build 17763.503,但是我没有收到Windows10 1903的更新文件,我应该怎么更新呢。我已经成功生成了terminal项目,但是因为没有Win10 1903的SDK导致没有办法部署运行该项目?谁能帮帮我? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

SwimmingTiger commented 5 years ago

@schuettecarsten I have the same issue before in both VS2017 and VS2019, and I solved it via repair my VS2017 (see https://github.com/microsoft/terminal/issues/837 for detail). Repair VS2019 may also works.

For me, building with VS2019 fails with:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Microsoft\DesktopBridge\Microsoft.DesktopBridge.targets(261,5):
error MSB3774: SDK "Microsoft.VCLibs.Desktop, Version=14.0" konnte nicht gefunden werden.
[d:\Projekte\Terminal\pkg\appx\OpenConsolePackage.wapproj]
AndrewGong2016 commented 5 years ago

Information you may needed (for chinese) 1 window 10 1903版本成功安装,done 2 VS 2019 部署该项目,done Oh yeah first time use the great VS

AndrewGong2016 commented 5 years ago

This is really fun. The green glow is awesome.

Can't wait to really dive into the code and get some things working.

Next order of business is to change the tab labels to the profile name.

image

I have deploy start the same window, but how can I add a ubuntu cmd ? what can I do ?

gottahavebling commented 5 years ago

Was finally able to build and deploy the solution. I see a new shortcut named "Windows Terminal (Dev Build" but upon clicking, powershell window opens up and dont see any plus sign on the toolbar. What am I doing wrong?

drekryan commented 5 years ago

Tab bar is hidden by default. Press Ctrl-T to create a new tab or go into settings in the drop down next to the plus button and change “Always show tab bar” to true.

gottahavebling commented 5 years ago

Tab bar is hidden by default. Press Ctrl-T to create a new tab or go into settings in the drop down next to the plus button and change “Always so tab bar” to true.

Ah. That did it. Thank you!

MichaelE919 commented 5 years ago

There are several header files which have the line "#include ", sometimes with a "windows.h." This file doesn't exist in the repo. Did Windows.h get replaced with another file?

DHowett-MSFT commented 5 years ago

Huh? windows.h is part of the Windows SDK. It has been for about a hundred years.

dantenull commented 5 years ago

Hey I ran into this issue as well and resolved it by deleting any saved settings and allowing the app to regenerate them.

I went to the following location

%LOCALAPPDATA%\packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState may also be %LOCALAPPDATA%\packages\Microsoft.WindowsDevTerminal_8wekyb3d8bbwe\RoamingState

and deleted any profiles.json file located there and relaunched the app.

@drekryan Thank you.I tried and didn't make the mistake last time.But it didn't run correctly.I can't use it.

iamdarknight commented 5 years ago

VS 2019 i used this successfully:

jduartedj commented 5 years ago

I was redirected here because of atlbase files missing but since the other thread was closed I wasn't able to see the resolution directly. FYI: to newcomers with atlbase issue you need to install the ATL v142 (for me at this moment). Quoting it:

In Visual Studio, you can go to Tools->Get Tools and Features, which will open the Visual Studio Installer. From there you can click the Modify button for your Visual Studio version, then go to the Individual Components tab at the top. The C++ ATL components are in the section titled "SDKs, libraries, and frameworks" which is the last section in my list at least.

Fair warning, I had to install the V141 versions to get the atlbase error to go away, not the V142 versions in the picture.

zugazagoitia commented 5 years ago

I'm getting the following error:

Details "C:\Users\Alberto Zugazagoitia\Documents\GitHub\Terminal\OpenConsole.sln" (default target) (1) -> "C:\Users\Alberto Zugazagoitia\Documents\GitHub\Terminal\src\host\ft_uia\Host.Tests.UIA.csproj.metaproj" (default targe t) (34) -> "C:\Users\Alberto Zugazagoitia\Documents\GitHub\Terminal\src\host\ft_uia\Host.Tests.UIA.csproj" (default target) (37) - > (PostBuildEvent target) -> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.ta rgets(5179,5): error MSB3073: The command "copy C:\Users\Alberto Zugazagoitia\Documents\GitHub\Terminal\\dep\WinAppDriv er\* C:\Users\Alberto Zugazagoitia\Documents\GitHub\Terminal\\bin\x64\Release\\" exited with code 1. [C:\Users\Alberto Zugazagoitia\Documents\GitHub\Terminal\src\host\ft_uia\Host.Tests.UIA.csproj]

It may have to do with the path double slashes, how can i get this solved?

PatrykZajac commented 5 years ago

I try to solve my problem, but I don't know what I make incorrect. I have error like: Severity Code Description Project File Line Suppression State Error C1007 unrecognized flag '-Yu' in 'p2' TerminalControl C:\Terminal\src\cascadia\TerminalControl\LINK 1 Error LNK1257 code generation failed TerminalControl C:\Terminal\src\cascadia\TerminalControl\LINK 1 Error C1007 unrecognized flag '-Yu' in 'p2' TerminalApp C:\Terminal\src\cascadia\TerminalApp\LINK 1 Error LNK1257 code generation failed TerminalApp C:\Terminal\src\cascadia\TerminalApp\LINK 1 Can anyone tell me what I make wrong?

drekryan commented 5 years ago

@PatrykZajac are you using the latest Windows 10 SDK (10.0.18362.0). Be sure it’s downloaded then retarget your solution to use this version of the SDK

PatrykZajac commented 5 years ago

@PatrykZajac are you using the latest Windows 10 SDK (10.0.18362.0). Be sure it’s downloaded then retarget your solution to use this version of the SDK

I upgraded windows to 1903 and now it's works. Thanks

plop28 commented 5 years ago

This is really fun. The green glow is awesome.

Can't wait to really dive into the code and get some things working.

Next order of business is to change the tab labels to the profile name.

image Nice, what theme or color did you used ?