.NET development for Windows AND Linux using WSL2 - Scott Hanselman. Dot Net North - June 2020

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right so you know I could bring up slides and we could do like a whole slide thing but frankly I think it would be boring and wouldn't add really any value so let's spend some time doing technical stuff shall we okay so what I've got here is a Windows 10 machine it should be a pretty regular machine it's not a windows insiders fast I'm on Windows 2000 oh 4 which is the April 2020 the 2000s actually it's 20 which is 2020 and then oh four which is April build so this is the latest build right now of Windows 10 and as such it has enabled me to put on WSL - ok I'm also running the Windows terminal which I'm going to talk about as well so let's do this let's start at the beginning if I open up CMD ok that's the command prompt i open up CMD i get this window and i think we've all seen this window before yeah core bob on Twitch there is saying that the april build came out days before the end of May yes but we're gonna pretend that it came out in April we're gonna do what's called a retcon that's a retroactive continuity that's when your favorite TV show goes back in time and says that a thing happened when it really didn't happen so we're gonna pretend that this came out in April because that's when they intended it to kovat slowed everything down but very good point all right so CMD here is interesting we've all seen this because we go here to start menu the system menu and we look at properties we've all seen this before right this is the same terminal that we've seen for many many years it's kind of ugly it's kind of slow it's kind of no fun here's the deal though we tend to conflate to combine the terminal with the shell the terminal is the thing that drew the box that this is hosted in the shell is the thing that's taking my text input and doing stuff with it so this is like this isn't like fake dass here right and this is it's not really dass but it has all these different features and I can type dir and I can do these different things and this shell is different from the thing that is painting on the screen and in fact if I did something like this dir / s it's going to go by so fast that on my side it's going put on your side you'll see a little bit of going by because we're doing this over zoom it only hit a screenshot so fast people who have used this shell this console this terminal long for a long period of time know the dirty little secret about it is that you can actually minimize it and make it go faster not awful thing about that if I say dir / s and then I minimize it it's going faster because it's not painting to the screen so people who have long builds will often find that the the DOS prompt or the log view or whatever they're doing goes faster when they minimize it that's because the painting to the screen of this console is synchronous right that means that it has to wait for the paint before it can actually do the next thing so your stuff is slow when this consoles on the screen even worse if I make it like really small like this it doesn't wrap well it gets confused already the console is confused about its size there's all kinds of things that are historically wrong with this console okay that's not saying that the shell is a problem but the console kind of sucks now if I run PowerShell bring that over here I'm using ctrl scroll I'm holding down the control button and I am scrolling with my mouse to zoom in on that this is PowerShell but the the frame the chrome the shell around it the console around at the terminal around it is the same that's because thing that did this the thing that painted this is called con host the console host and console host is in charge of painting this stuff and there's another shell I can run that will look at I can do things like get bash which some of you get when you install yet there's also Kubuntu which we'll talk about in a second I want to point out as I run these I'm getting the same shell that means that the limitations of this this this terminal and actually I'm doing a lousy job of using the right words here the the terminal the thing that painted is the same whether you're using Ubuntu or whether you're using PowerShell or fake toss or whatever it's all the same it's old it paints slow it's not smart about fonts and it doesn't do well with control it doesn't do well with control characters okay all right let's take a look here folks are asking on the questions here it's not available for everyone is there a way to safely force an update you can go and manually update it if you want to but if you go to Windows Update and it says your machines not ready that's because there's a driver a third-party driver on your computer that's preventing you from doing that I would probably not force the update now mr. Cochise is saying leave con host alone well that's interesting that you say that because in fact we are leaving it alone what they've done is they've they're leaving con host alone for compatibility reasons and instead of made a pseudo console and created on top of that the Windows terminal so Windows terminal I can go and run by hitting start run and I can type art WT is in the Windows Store and when I go and run that here I've got another copy of the terminal this application here allows me to have as many shells as possible and this is trying to really juxtapose and show you the difference between a terminal and a shell the terminal does the painting and the shell does the interaction model so I can go and run PowerShell for Windows PowerShell core not quite dos Ubuntu whatever and I can do it in a tab so if you are familiar with if you're familiar with like I term or X term X or anything all the different third-party terminals you get on Mac this is comparable to those the other thing is to point out that there are lots of other third-party shells there's a number of them and I'll actually open up notepad to show you let me open up a notepad here did you do okay so you've got the windows terminal right there's con host which are already using there is a con emu there's hyper there's terminus there's console - I think there was one called console Z all of these are third-party terminals okay and what's interesting about that and why that's useful is then you might say well hang on is Microsoft trying to kill these existing terminals with the existence of the Windows terminal okay so in fact what we're doing is building on top of the con PT y con PT Y which is a pseudo terminal that allows you and a third-party terminal to build on it so let me show you this here it's called the windows sudo console and this will enable other terminals to be awesome as well this is really important it actually goes through a whole discussion about the history of TTY and how teletype works how these things were invented and how they were used and then a discussion of the way that terminal talks to the app in the shell and then why Windows historically lacks a sudo terminal infrastructure and how Windows hooks things up in the past these third-party consoles have kind of sucked not to their fault but because they've been forced to screen scrape which is not really cool and the win32 console API is Windows Pacific so what we did is we made a con PTY which is a pseudo console that has a cleaner architecture that allows anyone to sit on top of it and then we've swapped that out and this is all a public API that allows you to do these things what that means is that when you pick a third-party terminal whether it's Windows Terminal or one of these that uses that con PTY you're going to have a faster better experience someone there named anonymous is saying looking in the source code which is totally open source on github they saw a couple lines of code regarding telemetry the telemetry and the terminal follows the telemetry rules in Windows itself so if you go into either the telemetry dashboard where you turn off Diagnostics in Windows then that will go away you can see them in the source code the telemetry is not for what you're typing at the command line it's for stuff like you know are you using tabs or not but all of those things that Windows puts in have to follow the rules for Diagnostics data and if you want to delete that turn it off see what it is you can also go and download the Diagnostics viewer to see exactly what is sent there's in fact a Diagnostics viewer in the Windows Store that'll let you see all of that stuff and additionally if you really feel strongly about it you can certainly build it from source and remove that stuff if you want to okay let's see what else we got here can you get this is crazy great questions here can you get the git bash shell into WT yeah absolutely if you wanted to that's a great question so let's look at that if we wanted to in fact do that so the git bash shell lives here okay and I wanted to get that into the terminal I could right-click on it and go to properties I could zoom in here okay and I could say all right that's how to get to get Bosch it's in CD program files get Bosch okay maybe I'll put that down here and then I could go into my terminal and I'll say settings we'll open up our settings here real quick that notepad there is called notepads plural dotnet Eady that is called notepads it's lovely I'm gonna go and take this here I'm going to make a copy of it will change the gooood this is not the way to generate a good get Bosch demo and then we'll go and we'll grab the get bash command line and we'll make sure we have some slash action there make sure that that looks good okay go back over here right and this is an interesting one so get bash this is great stuff what a good question so git bash is actually forcing itself to come out and jump it in its own window which means that this part of git bash look at that see so what's going on here is they're not using con host so any con host shell can be put into the windows terminal but this isn't a console app it turns out the git bash does its own thing it uses a thing called min TTY so that question that was just ants asked there by sans direction is an excellent one the I was surprised by this because what's happening is that git bash isn't following the rules it's not playing by the rules what they're doing is they're saying we're not a console app we're a Windows app so it just did what it what it does would Windows apps do if I went added it to notepad so then let's see this this is great stuff interesting so see da Skelos is suggesting putting it into a tab I don't know my friend let's find out this is good stuff this is why we do interactive conversations so I want to just take those shruts that you gave me in the chat here and let's go and see if this works maybe there's a way to tell get bash to chill out a little bit and open up there perhaps this CD to home oh I see what you're doing what you're doing here friend is your calling bash and not get bass so let's think about that remember how we discussed yeah the gooood is not verified if it makes you happy the gooood is verified as being unique for the purposes of this setting the question there that sebelum qu is asking is that what does this gooood mean that is a unique identifier that refers back to some defaults that are up at the top but the gooood is just guity enough within the context of settings so if you reuse it you'll have an issue but if you change enough of it it's probably unique but let's talk about this git bash as a Windows app but our friend and the chat there has just indicated that in fact bash dot exe is not by windows app it's a console app so that would give us hopefully the behavior that we're looking for so let's do this notice also that I'm not having to close the terminal to make these changes it's pretty cool Hey look at that kids good stuff thank you CD is closed so I'm not sure to pronounce your name what you've got there is a really interesting hey nice you like that cool so check it out let's go and explore in that folder there's two things going on here there is Program Files bin look inside of the gif folder we've got Minji and in there is git bash don't worry down in here somewhere but that's different from the supporting bash bin which is an actual console app what's cool about that also is that means if I right-click on this I'm going to right can hold down the shift button so I'm holding down shift I'm gonna say copy as path I'm gonna go back to the terminal I'm gonna go here to fake boss and I'm gonna right click and I'm gonna run it you see what I did there and I can hit exit and I'm back out again and that's really important to point out that the terminal doesn't care if you speak console this will automatically work so that's a really great thing for sans direction and our friend to figure out there and a little bit of Education for me because I was not thinking clearly but it's obvious once we do it that get bash and bash that exe or different things makes total sense now let's talk about though why they needed why they felt the need to do that in fact why does git bash exist in the first place git bash exists because the terminal sucks right that makes sense so when the terminal stopped sucking then you need it less which is really important but at the same time it's also we're interesting because there's two things that are included with git bash there is the console itself that does the painting and then there's the thing that is actually handling stuff like LS right this is not Linux this is not Linux this is new C portable C utilities recompiled for Windows so a way to prove that might be this let's see if I'm right let's go and run task manager let's go and find get bash in task manager alright and let us yeah see there's that and if I type like them can I find them in here try using process explorer because a lot of people feel yeah so sans directions saying it's fork from from cygwin or something like that exactly there's lots of good new utilities that have been made available to us in different ways obvious perhaps to you not obvious to to everybody which is interesting let's go looking for it explorer code min TTY vim all right look at that that is a Windows executable with the POSIX emulation and then the LGPL stuff that's included but it's all windows processes so it's it's not an emulation as much as it's a simulation which is interesting okay I'm going to go ahead and toss that okay and then of course I can get rid of get past if I want to or I can even comment it out so actually not even better check this out I'll just go and say hidden notice when I start typing that I get intellisense there's actually a a schema a JSON schema so I'm gonna say hidden equals true go back over here and now that's hidden because I don't want to see that right then that's pretty cool alright so what if I go and run Ubuntu okay so this is a boon to 1804 here's a coming to 2004 here's alpine here's W Linux here's Kali Linux I want to point out that there's one two three four five Linux's in seconds and if I run H top oops don't even have HT up on this one oh is that even this is this is actually which one is this let's go and say sudo at and stoops so do I have to install H stop notice I'm just that one would ordinarily use there's age type and there's my my 20 processors and I've got it looks like 12 gigs associated here and this is interesting because I actually a 32 gig machine but by default WSL which we're going to talk about in a second here can only use about half of your of your memory I think even at 40% there's a specific configuration that you can set if you want to use more it prevents you from basically overwhelming your machine and also that memory comes and goes it grows and shrinks based on what you're doing so that is really Linux in fact if I go out here and say LSB release - a we can see that that's a boon to 18:04 and that's cool Coelho is saying it defaults to 80 percent which is troublesome w7l memory config that is a great question there's a section here about memory reclaim for you to check out Coelho which talks about when memory reclamation was added let me check on that okay and then it actually will tell you when it reports back to the host it could then free it and you can go and run a test of your own and you can go and say you know free - H go and see let's see if we can try that over here all right so I can see what's going on in my memory and my swap and I will actually i'm simcoe I will go and check out of how that works and then I want to show you if you go down at the bottom here we can talk about running compact memory so if we look here and we say task man and we look at memory right now I'm gonna go ahead and sort by Ram right here you can see on my system here we're only really using 800 Meg's in our VM mem because in fact I'm haven't done anything so there's 12 Meg's as far as Oh as far as cores there's my cores 20 so I'm showing the same number of cores in both places so I've got a 20 core machine and I've got 20 cores in Linux I've got 32 gigs but I've only got a limited amount visible here and then of course if I was going to go and say something like compact memory no it looks like it doesn't me to do that right now I can control the memory that's being used by this vmm now let's point this out here vmm is kind of opaque why is that opaque well let's back up and talk about the goal of what we were trying to do with w cell so we saw how bash lets me run things like them but it's not really Linux and it's not really them but it feels comfortable but it's still it's still windows.net ed is asking you don't longer need to enable hyper-v so you don't need a Windows 10 Pro SKU anymore you need Windows home which is what everyone has so you don't need Pro you don't need hyper-v the feature but you do need a hypervisor ok and if you go into your features programs and features and you go in to turn Windows Features on and off this is a little bit confusing and it's not my fault there's hyper-v which is the whole hyper-v platform and all that stuff you do not need that checked what you need is a subsystem for Linux and you need this virtual machine platform if you have Windows 10 home you will not have hyper-v you won't be able to open up the hyper-v thing and in fact if I opened up hyper-v right now this doesn't even show up like this is not the same thing ok add Lang X is saying does it Park a virtual Linux instance in memory seems like a gig is a lot no it does not notice here I have no virtual machines let's go back out here and I'll show you how to control this so you don't feel bad about the memory that's being used or not used so this is all great questions and I appreciate those let me close all these here and I'm gonna say wsl - - list - V ok so we have one two three four whatever 7vm is running but look at this one here see how Alpine is version one the original version of windows subsystem for Linux was interesting in that if I go and say WS l - D for distro and I say Alpine we'll go ahead and run out pine and I'll hit like I don't think we had rooftop the guy just ran top okay no let's go and look at our task manager and we see something interesting here you see it says busy box that's part of Alpine everything is a busy box terminal a busy busy box process within the context of Alpine so that is what's called a picot process a picot process is a tiny fake process it's a it's a Windows process picot meaning small historically in Windows processes are a big deal if you fire up a process it's like fork but and that process gets a copy of the environment and copying processes and forking processes and Windows as an architectural decision from 30 years ago is a big deal so picot processes were made to allow one to do forks forks and Linux or Nothing forks like fork people in Linux like doing their pipes and stuff because they can go fork fork fork fork and everything is just cool so good thing about this as I can see in the task manager there's no Linux kernel though when I go and do things like LS and file system access has to happen Linux at the user mode needs to make a sis call a system call in C to some part of the kernel and what happens with wsl one is WS l1 is being lied to we are faking a Linux kernel ok the faking of a Linux kernel means that when someone wanted to do that file system access the Windows kernel got involved mr. tortoise if W cell is - list ssv doesn't work for you you may have an older version you may have a maybe on windows insider slow you may not have upgraded yet to the latest version of Windows if you hit win ver again windows ver if you are on version 2004 you'll have that - list - V ok so I mean you can prove it of course also by running your stuff and if you you know you're on w cell one if you run task manager and you see your put your processes so go run vim and see if you find them in that in the task manager then you're on to cell one okay W so one has some benefits because it's basically running the user mode stuff on top of Windows W so one's windows file system access is fast so what that means is if I come out here and I go to see that I'm at Mount see I'm on the Mount see and I can run around and go to like my Windows desktop this file system access is quite fast okay so if you are doing work and your source code is on the C Drive the windows C Drive w cell one would be a great great environment great system but if you are over here if you are in the Linux file system on WS l1 then you are going to not have awesome speed you're gonna have suboptimal speed that's because W sl1 has a lot of file system layering that's why W l2 is made if we go here we say W cell - - list I want to point out again to add Lang X it was concerned about running stuff and taking up memory I can go and say shut is it's a win w cell - - shut down and they're all gone there's no memory being used up right now it just works I can go in here there's no my no memory being used up it's just there it's chilling ok but if I say w cell by itself it's gonna go and run the default the one marked by a star here when I hit their cell one one thousand two and so about a second and a half I've got that started up that right there is using about 400 Meg's that is a utility VM that's not booting up hyper-v a virtual machine is like 30 gigs like it's a thing this is focused on starting up like that that thing started up in a second I want to be able to open Linux without thinking about it without it being a big deal okay I have total control over the lifecycle they'll go away after they're not being used they get cleaned up all of that stuff is really really important yeah so David bolon is asking how do you add a distro that's a great question I skipped that part and thank you for calling me out on it what I can do is I can do it two ways first I can go to the Windows Store and literally just type Linux I can pick one of the Linux this one is the only one that costs money it's really really cool I think it's like 10 bucks but it's basically an optimized version of WSL a custom version but there's also free lots of Ubuntu all of these are free Ubuntu is the default LTS versions are a good thing Debian you do all kinds of good stuff or or you can go W sell and we're gonna go and look at the help here you can import a distribution so if you have a friend who has a Linux distro that makes you happy you can go WSL - test export get a tar file they can give it to you and you can then import that one as well okay I'm someone who is saying what can be mmm to not do compared to a full-blown VM vmm job its existence is to get double yourself coming and going it's more flexible it it what's the word it compacts and expands its the wsl utility VM manager it's not about what it can't do it's about what its goal is to do it's its goal is to not be not be hyper-v which is the point now if we go over here and we say w cell and then I say like H top or whatever all of that is going to be hidden and managed inside of that VM mem what this means though is that there is in fact a real Linux colonel and this is important there is a WL Linux kernel that we sell Linux kernel github this is the source code for the Linux kernel being used in W cell 2 ok so you can go in here what this is is a a LTS release ok you can see the work that's being done on the next version you can follow their process this is the Linux kernel that is LTS it's not like a latest Linux kernel now you have full control though if you want to compile your own kernel and do fun stuff you can do that it's just a file on the disk so that's important to note they'll all use that same kernel unless you decide to go and add your own and do your own thing but here's some of the cool stuff that you could potentially do so let's see which one that we're looking at here do yourself release - Aron boom - yeah it's super super small now check this out CD tilde this is the Linux file system this is important WSL two's file system support access speed is ten times faster than W cell one when you're on the Linux file system okay so that's really important if you are what if you are using W SL - but you're doing work on mount C you will be disappointed in your file system access because you're actually talking to a mount point that's a network mount it's a network mount back to yourself okay that means there's too many layers so if you're doing like node modules type stuff if you're doing a bunch of tiny little file system access things you're gonna hate life if you want your files on the windows filesystem W so one if you want raw speed a real Linux kernel all the benefits stay over here so maestro is asking how do i code a web api but have a debug and run on w cell great question let's do this make a folder it's empty know where we are we are on the Linux file system I'll just use dotnet new web api we'll go and create one now notice what I'm doing here let's go and say which dotnet this is using a Linux install of dotnet right here okay we're not using the Windows install done that so I should probably confirm what version I think I'm using version 3.0 one that's cool you can go and say dotnet run okay and then I can go and grab my browser and let's go and say localhost 5000 actually that's a funny one so this is interesting I've been having an issue with this if you've ever done they're called service workers notice how this brought up a totally unexpected page that's because I run my podcast site on a on net and I run it using a service worker and that Service Worker tends to stick around because I wanted my site available offline and unfortunately I never remember maybe one of you can help me how to delete the Service Worker to have it let go so that I can turn off this issue under at my shoot there's other applications you said no it's not under apps I think it's in settings application tab application tab and dev tools cool so obnoxious it's very frustrating yeah need to unregister it you're exactly right which one of these friends go back and escape yeah mmm-hmm I always this happens to me like twice a week I you think I'd remember it it's there at the top there it is really loo that unregister good job everybody so this is a good reminder okay thank you for that friends so what they're showing out is that that serviceworker is stuck there that's super obnoxious and annoying thank you for fixing that and now we can go back to our regularly scheduled program which is super annoying okay what is our default there we go yeah it's awful it's very frustrating so this is saying I think it's API slash your values I never remember the default what I'm going to do is I want to try something interesting to show maestra how this works when I hit code dot and what we're to do is from Linux run Visual Studio code but look look look it just said updating vs code server C updating vs code server it's split vyas code in half and now it is downloading the Linux pieces while still running the windows stuff yarn Chuck's Todd is asking can I access the Linux file system for Windows that's great question Explorer dot exe dot just like I said code dot hit enter watch this kids look at that hmm yes you can because it's showing up right here that presents to itself now let's look here what's going on is that Visual Studio code knows that it's remote and in fact I can prove it by saying file open file look at this that is the Linux file system that's different from if I say show local which is the local file system so half of Visual Studio I'm glad that your head is exploding I don't want you to hurt yourself but it makes me happy look at this I'm gonna hit H top look there's a PS code server the headless part of vs code is running on the server in Linux and these the client side the the front-end is here envious code so that means I can go and open up my weather forecast oh there we go controller what is it controller slash weather forecast let's go back and run it what is this witchcraft it's the new Microsoft kids it's crazy stuff yes that is coming soon for visual studio proper remember this what are we thinking here let's look at the startup map controllers I'll just get this wrong weather forecast [Music] it's either API or its slash weather forecast look at this can do all these amazing things with Linux and Windows but I can't spell weather there you go not cool mr. tortoise is saying is that because V s code is electron oh there's something special bill for it actually has nothing to do with it being built for electron in fact what it's doing is it's simply splitting the front-end that draws the the text and the backend that is going and talking to the I can tell a code as an example let's try this see how we've got this logger option and I go logger what is the thing when I hit dot that pops this down what is the thing that makes Intelli code that's called language services so at that moment there when I go dot who did that well in this case Linux did that okay here is a way to think about this that's even more insane that's even cooler we've been doing this in dotnet but you can see that I have dotnet installed here in in in Linux so that's let's amount less interesting but I don't have go installed the go language and if I go to the Windows PowerShell command prompt I in fact don't have go installed here actually I want to interrupt add Lang X there he's saying don't try to drag files to the Linux directories and expect them to be available I'm gonna gently push back on that that's not true anymore it used to be true in the early days but not anymore in fact I could go and open up notepad and I could bring notepad over here which has now been updated I'll just go ahead and drag programs here and I want to point out a couple of things I can decide in notepad now whether or not it's Windows crlf or not but I could also make a file on my desktop okay and let's make a file we'll just say new item text document foo-foo dot txt okay I'm going to open it and then I'm gonna say hey this is a document in Windows it's sitting on the Windows desktop I'm going to pick it up and I'm going to drag it over into the Linux file system okay there's foo-foo job text now what I can do is I can go back out to boon to and I can see that fufu dot text is there I can cat it and I can even go in vim and edit it I can then say this is some text in Linux save that okay come back over here and open up that text file in Windows did I actually save it okay there we go notepad dot exe oops ah JC and I can see that text the reason that that works and why it was a problem an ADD Lang X is pointing out that this was in fact a problem the issue was before Windows and Linux didn't have any way to know that files were changing to their point you would change a thing and then no one would tell Linux because the windows file system changed it here the trick is when you are in Windows and you're talking to this you're actually talking over the network there's a boundary right there's a network boundary to cross over this is called a plan 9 server this is a file server that's allowing us to go and edit our code in both places now that doesn't mean that you don't have to think about your line feeds you'll notice here we're still on UNIX LF so we had to think about that but now that you can see that that's just way way way better so definitely definitely check that out it's pretty fantastic carl codes is saying i'm not brave enough to try insiders on their main deb machine encourage you to try insider slow i think it's a good it's a good thing and i also agree with thought in a tad that disabling the Windows Store is a bad policy and it shows a lot of ignorance on the part of IT but you can rename that if you have a local administrator maestro is asking about ligatures in notepad this is notepads which does not have ligatures and if I bring up notepad.exe I do have the ligatures only because that's my default font is a ligature enabled font the font that I'm using right here is Cascadia code ligatures are an interesting thing because if I said something like this right or something like that for something like this www I get a glyph I do not use notepad plus plus ad letting X is saying I'm not a fan of no plate plus plus for a very simple reason it's not pretty I like attractive applications I like an app to be good-looking and this app here is my new favorite it's called notepads notepads plural I got that in the Windows Store I use notepad too which is one better than notepad but notepad plus plus is unattractive and I don't like the way it does its tabs so I would encourage you to check that out in fact all right point random things and folks farther back in the chowder saying that they are having issues with snip and sketch I use shift windows s and then I can go and make a snip shift windows S is now built into windows and gives you a built-in snipper the other thing that you get with Windows 10 now is if you hit windows and v-notch not ctrl V but windows V you get a built-in clipboard manager as well which is pretty cool ok this idea that I could go back here let's go back and let's do this again code dot run my application mess around with my application yes it's like ditto in fact I could do this kind of work inside of BS code coming soon if you take a look at the dotnet talk that I did at Microsoft build it's free and it's online we're adding direct wsl support from Visual Studio 2019 you just hit f5 and it'll work it's lovely and what I can also do here if you notice I just pressed f5 check this out so here we're going to go and I think we said it was weather control weather forecast I haven't set up my my SSL certs yet let's go ahead and put a breakpoint here there you go so here I'm in a browser on Windows on Visual Studio code on Windows doing debugging interactively and I've now dropped into a breakpoint and there's my watch window my call stack all inside a Visual Studio code which is pretty sweet all right that will be in Visual Studio proper visual senior I'm not sure what we're calling it ooh let's give two minutes to give feedback to Scott let's make sure that we do that make sure you do your feedback excellent further or the further away than Europe yes I've been to Manchester how convenient love it love it love it love it love it love it good job everybody excellent cool so yeah a lot of cool stuff there let's read let's let's recap let's recap a terminal is not a shell you can use the Windows terminal it makes you happy but you can always use Connie Mew and hyper and a ton of other great fun things you can get wsl too now on 2004 version of Windows in the newer insiders builds in the future you're gonna see something interesting where turns out next to this PC is going to be a little Linux tux we're having a little penguin there so Linux is going to show up there as well ooh one thing we didn't talk about was docker oh my goodness docker desktop what a joy docker desktop is lovely and let's go ahead and fire that up and I'm going to bring it on my one machine and bring it over here docker desktop has a feature if you go under resources and wsl integration look at this where you can actually set up docker for your WS l to distributions okay this is super helpful because that means I can go out here I'm in Linux here's a question here so I view feble of is saying no to those running code insiders oh I see your point is if you are running insiders you start it like this as opposed to starting it like this yes that is absolutely true you can run them side by side docker docker images I can see my docker images from Linux I can then go over here and I am in Windows and I could say docker images and I can see the exact same ones that's because the context is shared now here's something really clever you thought your brain exploded before okay you ready for this remember when we said wsl - - list - V how does docker work docker works because it is its own WSL - distribution I am in fact running Duncan for Windows doctor for Windows sets up its own docker distribution and then docker desktop data handles mount points and then they are hidden inside of the windows terminal although you could certainly go into them if you want to and that allows me to do things like this let's go to my Windows machine notice my fancy prompt which is just lovely look at that shows my my git branch and that I have two items that I'm working on and I went and I made docker tests so I'm gonna say docker test and this is interesting this is a ps1 what that is is that is a powershell core script notice the shebang at the top there that makes it run on Linux as well and I'm gonna say docker test so what that's going to do now is on Windows I am using the native hyper-v docker stuff on Windows okay this works on Windows home you can run docker now in Windows Home which is great for students and folks that don't want to pay for pro on their personal machines and I'm actually going to go and build and I'm doing the build inside of the container so I don't have dotnet doing the work on my metal here the build is happening inside of docker then I'm actually gonna go and run my unit tests in docker and I can detect that I'm in docker so I can even I can even do headless builds if I wanted to put in like right now I'm going to skip my selenium builds well that is running actually I want to take a look at this helpful comment that was put in here look at that yeah explaining exactly why wsl wanted to sell to have these these boundary issues as well as why caching can be a problem incredibly detailed I would encourage you to check out that very very clear this is the takeaway if it is all possible store your projects in the Linux file system that'll be faster than anything what I'm doing here is I'm actually being selfish and what I'm doing is I'm keeping my stuff on the windows file system but I'm using docker to go and do the build in the tests so look I just ran my tests I skipped four of them because I don't run browser and selenium tests inside of docker which is really cool I did all of these tests are all functional and unit tests but yeah the the link is in fact in the chat ad lang X it's just above you so that link is already there I'll put it there again if you want yeah there it is it's right up up there okay so that docker stuff works right now now remember before I was making a comment about how I don't have go on my machine I wanted to point that out really briefly and then we can do some questions and I have to go to my next thing okay here we go check this out so I don't have go but I want to do something and go so I'm gonna hit code dot I'm gonna fire this up I'm on Windows everything's fine and Visual Studio is gonna say hang in a second there's a developer container here do you want to develop in a container I will say reopen in container watch the lower left corner here look at this starting a dev container what's going on what it's doing is it has got a folder called dev container with a docker file in it that docker file knows how to setup Linux with go but I don't have go installed very important I do not have go installed so in fact remember how we talked about how Visual Studio splits in half go support is installed in the container so Visual Studio code runs and windows part of Visual Studio code server runs locally in Windows another separate part the language extensions the language extensions for go are running in the container go is installed only in the container okay what if I wanted to open up a terminal yes say I'm baking heads explode left or right look where I am at now I'm in a folder called workspaces in vs code in the container so I've now opened up a terminal in bash inside of the container okay so we are sitting here in a docker container doing some stuff now when I go and say I o dot who did that work who did that work who gave me the intellisense go did the remoted go extension running in the container so now the building and the running and the setting up of the machine is nothing it's non it's non trivial no it's totally trivial rather go isn't even installed in my computer so then you ask yourself how you might do something like this with Visual Studio code spaces if I can split windows in half why don't I split it in half and put one of them in the cloud maestro is saying basically the container is like W sells stuff before the difference is the W sells stuff was metal one piece of metal talking another piece of metal in the sense of the persistent Windows filesystem the persistent Windows environment was talking to the persistent wsl stuff this one here is now in a container except the container is not persistent the container comes and goes containers get thrown away so this works basis folder is a volume mapping back over to the the filesystem the source code lives still on the D Drive on my computer so the source code did not move and that allows me to do my work here vs code there we go so that work happens here and it's the existence of the dev container right there that that does this for me which is fantastic all right cool all right friends on zoom' I've only got a couple more minutes left because I've got I actually am at work right now and I'm on my lunch hour maybe about 10 more minutes how do we feel things are going Mike you feel good yeah this is good this is mad great great question yeah really interesting and yeah seriously advanced stuff you've shown us there Scott it's been absolutely brilliant I hope someone was saying that they would they would have to play it back in half speed I didn't mean to go fast there is a lot here one of the things that's worth pointing out is that we have basically popped open the the hood what is that what is it the boots the trunk what do you call the front part of the car in the opponent's the bonnet we pop the bonnet open on this thing and we're standing in front of the car having a whole chat about what's underneath the bonnet the fun part about this and the important part is that you don't need to know about what's under the bonnet in order to do your work a regular person this is really important a regular Joe or Jane is just gonna sit down and they're gonna type code dot they're gonna run it and it's just gonna work they'll have W cell by default because by then it'll be out oh oh it's a defconn Hangul they hit reopen it'll spin up right it is very dense mr. tortoise is saying I didn't go too fast it's just dense getting all this working and managing and guiding the product may have been an insane task it has taken a while to get to this point but let us remind ourselves what is necessary so windows 2004 install w cell to install windows terminal all these things could be installed by default put on Visual Studio code any version of that get some source get some source put it on you know whatever you get a Linux actually get a Linux put it on this you know put it here go to here type code dot and it should just work you shouldn't have to do anything so it shouldn't you can set that up in about an hour yeah-ah Levias code WSL extension that's a great point vs code is smart enough to do this for you as soon as it sees that you have WSL it will install the extensions that you need automatically good question I don't have any examples of Oracle clients within W cell to maestro but I will point out that it's just Linux so it'll just work it should just work these things are it's just blending so if it runs on Linux 99% chance it'll run just fine here without too much too much trouble cool should give you a lot of really interesting ways to think a lot of ways to work and then the being able to go into code spaces is really interesting this is where you can actually go into the browser and then that container could then spin up in the cloud so rather than you having a beefy machine like I do with a lot of cores why not just put all the debuggers the source and everything in the cloud and then just make an environment and then the browser-based editor just kind of works so actually let me just you can see if that works well people are asking questions here I will go and login oh yeah RJ Perry is talking about w cell gooeys and stuff yes if you want if you want to do that ad Lang X is being salty as per usual my friend from Twitter it ain't free it isn't free but it is charged by the second so if you don't want to spend any money suspend it I sent my suspend after 30 minutes but if you want to be really careful you can actually just say after five minutes okay so I can't go and spin up this this this core here and say connect and then will basically spin up an environment here it's going to resume that space so in a little bit we'll spin up you see visual studio codes already starting to come up here so the goal here is if you have a powerful machine you can use it if you don't have a powerful machine you can rent one by the minute so good stuff cool any other questions my friends anyone unzoom with a question Oh stupid question David ballon can now that we have Linux what can we do we couldn't do before on Windows my developer perspective that's a great question so the thing that I like about being able to do this stuff on Linux is when I'm out there in the world and I go and search for something and I go and say hey how do I install Redis I go and I search for Redis and I go to a website and I show up there and it's like yeah how to install open-source thing right and then you go to that webpage and then there's a dollar sign and it says type app install Redis server and then I feel like a Windows user I'm like oh that kind of sucks and that's not for me I'm not supposed to be here those days are over now I can have a Windows net that talks to a read a server on Linux that talks to Postgres reality is a hybrid so what I can do now is I can do anything anywhere and I can also in the very near future run GUI applications on wsl as well there's hacks to do it we're going to make it official you will be able to run Linux GUI apps on Windows so yeah Linux on the desktop is happening it's just happening on the windows Desktop which is pretty cool the point is to be inclusive that you don't want to have people feel like they can't do something so hopefully in the future if you're a you know computer science 101 class then you would just sit down and start typing at the command line this right here by the way to take a look I'm now looking at some dead code that I had left over from a couple weeks ago and I'm in Visual Studio except I'm in Visual Studio online alright that cool it's yeah it's really actually in the browser so theoretically I mean that could work on an iPad if the iPad had better had a better browser but it certainly can work on a Chromebook all right good stuff
Info
Channel: Dot Net North
Views: 2,600
Rating: undefined out of 5
Keywords: dotnet, dotnetcore, windows, linux, windows 10, dot net, dot net core, wsl, wsl2, .net, scott hanselman
Id: ygR7F5VzPVE
Channel Id: undefined
Length: 62min 6sec (3726 seconds)
Published: Thu Jun 18 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.