microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.85k stars 8.21k 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"
}
nbsriharsha commented 5 years ago

@audac1ty image It shows my windows is up-to-date. I am using Windows 10 Home edition. Do we need to update it manually?

Have you upgraded to the latest windows insider build? It should be 10.0.18362

How do we do it ? I am completely new to it.

Vargnatt commented 5 years ago

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 MSB8020 无法找到 v142 的生成工具(平台工具集 =“v142”)。若要使用 v142 生成工具进行生成,请安装 v142 生成工具。或者,可以升级到当前 Visual Studio 工具,方式是通过选择“项目”菜单或右键单击该解决方案,然后选择“重定解决方案目标”。 PropertiesLibrary D:\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets 67 could someone help me? I am new here

https://github.com/microsoft/Terminal/issues/461 check this

y0d4a commented 5 years ago

@y0d4a you should do the submodules thing in the README...

i do that... and always got that error. But that folder exist inside dep folder... somewhere in code is wrong path or mine environment is not ok... :s ?

y0d4a commented 5 years ago

y0d

damn, it mine fault, i don`t have 1903... still on 1809... that can be cause..

fcharlie commented 5 years ago

Open Developer Command Prompt for VS 2019:

git clone https://github.com/microsoft/Terminal.git
cd Terminal
git submodule init
git submodule update
nuget restore OpenConsole.sln
msbuild /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v142 /p:TargetPlatformVersion=10.0.18362.0 /p:PreferredToolArchitecture=x64 OpenConsole.sln
audac1ty commented 5 years ago

@audac1ty image It shows my windows is up-to-date. I am using Windows 10 Home edition. Do we need to update it manually?

Have you upgraded to the latest windows insider build? It should be 10.0.18362

How do we do it ? I am completely new to it.

https://www.windowscentral.com/how-join-windows-insider-program

This should help you update to the latest build :)

ankitbko commented 5 years ago

Can someone host a binary for Win10 64 bit? I wonder why they haven't made a release yet?

It cannot be a binary. It is UWP app so needs to be deployed (packaged and installed through store or sideloded).

I am not an expert in UWP so don't know the correct procedure to publish it but will give it a try. Unzip the file and run Add-AppDevPackage.ps1 using Admin ps. [link scrubbed]

Before installing this, you must enable developer mode by following Step 4 in the first post of this thread.

If you get some random and weird certificate error you need to install the certificate present in the folder under Trusted Root Certification Authorities under Local Machine by following following steps present here

Note: High change this may not work as I am on windows insider and don't know how to publish UWP applications for different platforms.

DHowett-MSFT commented 5 years ago

Hey @ankitbko, Thanks for being excited about this. Please don't use this issue tracker to share binaries -- it's not ready to be used by the general public, and that's why we haven't published a version of it to the store or the selfhost rings.

Giving out a binary leaves people under the impression that it's Microsoft-supported, and we just can't do that yet.

ankitbko commented 5 years ago

Ah got it.. thanks @DHowett-MSFT.

Sorry @perryizgr8 I can't share it here as it gives wrong impression as I am also part of Microsoft. Thanks for understanding.

perryizgr8 commented 5 years ago

@ankitbko Thanks for trying!

xdagee commented 5 years ago

can't see deploy after building. anyway we can run in cmd?

ankitbko commented 5 years ago

can't see deploy after building. anyway we can run in cmd?

If its successfully deployed, you will see it in start menu.

nizos commented 5 years ago

can't see deploy after building. anyway we can run in cmd?

Do you see the Solution Explorer side menu? If not, then press Ctrl+Alt+L or go to View -> Solution Explorer. At the top of the Solution Explorer, the top most item is: Solution 'OpenConsole' (47 projects). Right click it and choose Deploy Solution from the context menu.

image

jlandrum commented 5 years ago

It absolutely needs to be put into the Readme that you can NOT use Visual Studio 2019, especially since Microsoft is known for making legacy software harder to access (including Visual Studio 2017, which after uninstalling it I still don't know how to re-download).

Using VS2019's update tool doesn't work either.

ankitbko commented 5 years ago

@jlandrum It works for me using VS 2019. What is the error that you are seeing?

Drakota commented 5 years ago

Followed the tutorial on 1904, build on x64 release without any errors and I get this: image If I open Windows Terminal (Preview), I get: image

zadjii-msft commented 5 years ago

https://github.com/microsoft/Terminal#i-built-and-ran-the-new-terminal-but-it-looks-just-like-the-old-console-what-gives

Drakota commented 5 years ago

@zadjii-msft

https://github.com/microsoft/Terminal#i-built-and-ran-the-new-terminal-but-it-looks-just-like-the-old-console-what-gives

Thanks that worked.

image

Is the acrylic effect supposed to work right now?

zadjii-msft commented 5 years ago

@drakota yes it's supposed to work, but it will only work when the app is focused. This is something that we can't control unfortunately, that's just how acrylic works. There are other magic things that control acrylic - it won't work over remote desktop connections, and supposedly it doesn't work on battery-saver.

Ctrl+Shift+mouse wheel should adjust the transparency of an acrylic tab, so you could try that to make sure it works.

Biswa96 commented 5 years ago

Now I successfully build the whole project (2 warnings) in Visual Studio 2019 + v142 + SDK 18362. Any tricks/commands to build only OpenConsole.exe without building others?

DHowett-MSFT commented 5 years ago

Yeah, right-click “host.EXE” in the conhost section and choose Build. That’s pretty basic VS usage. You can also set it as a startup project so when you F5 it launches OpenConsole.

skasturi commented 5 years ago

can't see deploy after building. anyway we can run in cmd?

This happened to me and the problem was that I had some projects that were not loaded properly.

I opened this solution VS 2017 before I installed the needed Visual studio components. This resulted in some of the projects not loaded properly. I had to right click on the individual folders and click "Reload projects from the Solution folder".

Make sure that the successful build is more than just 2-3 projects.

taosx commented 5 years ago

First, we thank you for this, it will make the lives of devs worldwide easier. Two, how much time does it take for you to compile using vs2019? Three, how much memory do you need to compile (aproximately)?

gjsman commented 5 years ago

Thanks for the guide! I just built on Windows 1903 (non-Insider), using v142. It wasn't nearly as painful as I thought it would be.

robinwilson16 commented 5 years ago

Please can someone tell me what I am doing wrong as I have tried to download the zip, clone the git and tried to compile from commandline, VS 2019 and VS 2017 after installing the dependancies and each time it results in something like

========== Build: 5 succeeded, 42 failed, 0 up-to-date, 0 skipped ==========

Mostly the error is:

fatal error C1083: Cannot open include file: 'wil/Common.h': No such file or directory

If I try to open the file from solution explorer, sure enough VS tells me it can't open it.

I use VS all the time and don't have issues building my own projects, granted they are not nearly as complex!

Thanks

kbalint commented 5 years ago

@robinwilson16 : you're missing thegit submodule update --init --recursive step, it will download wil

handyjellyfish commented 5 years ago

Hi all,

Lots of discovery overnight so this may not be required anymore but I was successful in building this using just the VS2109 Build Tools (i.e. no Visual Studio installed). If anyone requires a writeup on this please let me know.

Cheers Rich Young.

robinwilson16 commented 5 years ago

git submodule update --init --recursive

Thanks @kbalint I had run it but had run it in the folder above where I ran git clone and I had not cd'd into the Terminal sub-directory. That error is now resolved and trying to build again. Thanks for the help! Robin

robinwilson16 commented 5 years ago

git submodule update --init --recursive

Thanks @kbalint I had run it but had run it in the folder above where I ran git clone and I had not cd'd into the Terminal sub-directory. That error is now resolved and trying to build again. Thanks for the help! Robin

Now I am getting this error and now only 7 fail to build so it is progress:

error C3859: Failed to create virtual memory for PCH

Does anyone know how to fix this one?

robinwilson16 commented 5 years ago

Here is a guide for building from cmd although the last step fails which may be due to me having multiple versions of VS installed (from searching online) but not sure yet how to fix. This may work for others with only one VS

mkdir C:\Terminal
cd C:\Terminal
git init
git clone https://github.com/microsoft/Terminal.git
cd Terminal
git submodule update --init --recursive
"C:\Terminal\Terminal\dep\nuget\nuget.exe" restore OpenConsole.sln
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe" OpenConsole.sln

The error I keep getting is (variations on path but same error):

c:\Terminal\Terminal\src\common.build.pre.props(3,3): error MSB4019: The imported project "c:\Microsoft.Cpp.Default.pro
ps" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [c:\
Terminal\Terminal\src\buffer\out\lib\bufferout.vcxproj]

So far I have had zero success building this from VS 2017, VS 2019 or CMD What is the secret to getting it to build?

robinwilson16 commented 5 years ago

@handyjellyfish I would really appreciate a writeup as I have tried everything and it just isn't working for me :(

hapylestat commented 5 years ago

@robinwilson16 use those issues as the guide source: #508 (translate it via google), the part from @SwimmingTiger; #449; #461. It will lead you to the state when build is ok, but no way to deploy on 17763 or working application on insider build.

P.S. I found use-full OpenTerminal.exe on 17763 as it able to follow windows color theme, so i have backed up original conhost and replaced it with new one :)

image

handyjellyfish commented 5 years ago

@handyjellyfish I would really appreciate a writeup as I have tried everything and it just isn't working for me :(

Hey @robinwilson16 that error that you are getting looks very much like you don't have the CPP libraries installed properly. Possibly because you are using the wrong msbuild. What I would try first is run razzle.cmd from the tools directory then run your commands again (but just running msbuild.exe OpenConsole.sln /p:Configuration=Release /p:Platform=x64) if you have 2017 installed properly it should be all that you require.

taosx commented 5 years ago

I have followed the following steps:

And after all this: exception_base h

Exception thrown at 0x00007FFB6AF4A839 in WindowsTerminal.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x00000086DA31E808.

Edit: I think the team had a reason there's not a binary, it's not ready yet. I think I'll wait till mid June. Have some good sprints!

@Berrysoft still not working, got some errors this time (unfortunately I deleted all repos and tools related with Terminal (40+ gb together with the components installed)

ZgblKylin commented 5 years ago

Hey guys, I've created a pull request to fix compile warnings and errors, after it's merged, this issue can be closed :)

taosx commented 5 years ago

Hey guys, I've created a pull request to fix compile warnings and errors, after it's merged, this issue can be closed :)

Would it solve the issue I mentioned above, it doesn't seem like it.

Berrysoft commented 5 years ago

@taosx Have you tried Release build? Maybe it's a Debug-specific error.

Fordisk123 commented 5 years ago

I have followed the following steps:

  • I upgraded to insider build 1903.
  • Installed VS2019 Community
  • Installed Visual Studio Build Tools 2017 and 2019
  • Added:
    1. C++ (v142 & v141) Universal Windows Platform tools
    2. Windows 10 SDK (10.0.18362.0 & 10.0.17763.0)
    3. MSVC v142 & v141 – VS 2019 C++ x64/x86 build tools
    4. C++ ATL for v141 & v142 build tools (x86 & x64)
    5. C++/WinRT
  • Installed WinRT package
  • Run:
    1. git clone https://github.com/microsoft/Terminal.git
    2. git submodule update --init --recursive
    3. nuget restore OpenConsole.sln
  • Opened Project/Solution from VSCode
  • Right-click "Solution 'OpenConsole'" and "Build Solution" => no errors (succeeded)
  • Right-click "Terminal -> WindowsTerminal" and Debug -> New Instance

And after all this: exception_base h

Exception thrown at 0x00007FFB6AF4A839 in WindowsTerminal.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x00000086DA31E808.

I have the same problem as you.

ZgblKylin commented 5 years ago

Hey guys, I've created a pull request to fix compile warnings and errors, after it's merged, this issue can be closed :)

Would it solve the issue I mentioned above, it doesn't seem like it.

It seems to be some bugs but not build errors.

You can deploy and run release build, and it works fine.

lycug commented 5 years ago

emm, Does it possible to use this new Terminal with Win7?

jingzhou123 commented 5 years ago

Can anybody share an EXE

hapylestat commented 5 years ago

@lycug short answer is no. Long answer - Win7 doesn't support WinRT, UWP and i guess a bunch of another stuff

ZgblKylin commented 5 years ago

emm, Does it possible to use this new Terminal with Win7?

Unfortunately not, it's built with UWP and some new features in 1903( new ConPTY API).

ZgblKylin commented 5 years ago

Can anybody share an EXE

Unfortunately cannot, see About installation chapter in this issue and FAQ in readme.md.

pr0ph0z commented 5 years ago

Sorry maybe this is out of context but, in the promotional video shows that in the terminal there's option Ubuntu, and other distros. I've installed Ubuntu WSL, but there's no option. Is this feature isn't available yet? Thank you.

handyjellyfish commented 5 years ago

Sorry maybe this is out of context but, in the promotional video shows that in the terminal there's option Ubuntu, and other distros. I've installed Ubuntu WSL, but there's no option. Is this feature isn't available yet? Thank you.

Hi @pr0ph0z - you can add other shells into your windows terminal using the settings - should be reasonably obvious how to by looking at the ones that are in there already or check out Scott Hanselman's blog post around it : https://www.hanselman.com/blog/ANewConsoleForWindowsItsTheOpenSourceWindowsTerminal.aspx

glowtape commented 5 years ago

Is there supposed to be a menu and tab bar? I see them on screenshots of some builds people did, however over here, it's just a title bar and an acrylic terminal area. No settings on the title bar, nothing in the system menu (like in the old console window).

DHowett-MSFT commented 5 years ago

Press Control+T


From: Mario Goebbels notifications@github.com Sent: Tuesday, May 7, 2019 10:04:42 PM To: microsoft/Terminal Cc: Dustin Howett; Mention Subject: Re: [microsoft/Terminal] Guide for build new Terminal (#489)

Is there supposed to be a menu and tab bar? I see them on screenshots of some builds people did, however over here, it's just a title bar and an acrylic terminal area. No settings on the title bar, nothing in the system menu (like in the old console window).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTerminal%2Fissues%2F489%23issuecomment-490348598&data=01%7C01%7Cduhowett%40microsoft.com%7Cf56e6c4af2a24aaf51d808d6d372ae6d%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=8nhZM1bgyDZaJW3bFtEg1FoTHwfCxVquKd1RuGTH%2BvU%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FADNHLGWAJQGJBVYBHOF5MRDPUJNOVANCNFSM4HLHRKIQ&data=01%7C01%7Cduhowett%40microsoft.com%7Cf56e6c4af2a24aaf51d808d6d372ae6d%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=p11Rf3bfmTnnW0yAYyN1mizzeDU9mI%2Bp9ubIZvm%2BVsk%3D&reserved=0.

ZgblKylin commented 5 years ago

Sorry maybe this is out of context but, in the promotional video shows that in the terminal there's option Ubuntu, and other distros. I've installed Ubuntu WSL, but there's no option. Is this feature isn't available yet? Thank you.

Open settings, you can add wsl profile manually.

Press Ctrl + T will open a new tab, and show the menu dropdown, click Settings, then you'll see the profiles.json.

For example, I copied cmd profile, rename to WSL, change the commandline to wsl.exe, and give it a new guid:

{
    "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"
}
krzykli commented 5 years ago

I've followed the steps, built the solution successfully, but I'm getting this error when I try to deploy: 17>LINK : fatal error C1007: unrecognized flag '-Yu' in 'p2' Anyone else getting the same thing?