Play by Play is a series in which top technologists work through a problem in real time, unrehearsed, and unscripted. In this course, Play by Play: Visual Studio Live Share, Scott Allen and Brice Wilson demonstrate how to use Visual Studio Live Share to share code and collaborate on different types of projects. You'll learn how to follow developers through a codebase, work independently in the same shared project, debug together, and expose servers and terminals to other developers in your Live Share session. Along the way, you'll also learn about the security features built-in to Live Share, some of the configuration options that are available and how to use the technology across platforms. By the end of this course, you’ll have a solid understanding of the features available in Visual Studio Live Share and how they can enable you and your team to work more collaboratively whether you're just down the hall from each other or thousands of miles away.
Scott has over 15 years of experience in commercial software
development and is a frequent speaker at national conferences,
and local user groups. Scott is a Microsoft MVP and has authored
books on several Microsoft technologies, including ASP.NET, C#,
and Windows Workflow.
Course Overview In this course, Scott will help me understand some of the features and capabilities of Visual Studio Live Share and how it can enable more collaboration between developers. First, he introduces us to exactly what Live Share is and a couple of the most natural use cases where it can enhance developer collaboration and productivity. Brice and I are going to get into a demo pretty quickly, and Brice is going to help me implement a new feature in a web application while we're both using Visual Studio on our own computers. That way you can see how Live Share sessions work, how they're initiated, and how they are secure. I also want to show you how you can share servers through Visual Studio Live Share, and we'll even see how to debug an application together. And in the second half of the course, I'll use Visual Studio Code on my Mac and invite Scott to help me edit a node in Angular app using Visual Studio on his Windows laptop. I'll demonstrate how to share a terminal, and we'll talk about the obvious security implications of that. Scott will also show how he can initiate a debug session from Visual Studio on his machine, and we'll talk about a few techniques for securing individual files in your projects. So if you want to do a code review or pair programming or mob programming or a classroom session, and you want to work with other developers in your own editor, then Visual Studio Live Share is the technology you should try out. We're going to show you how to do that.
Introduction to Visual Studio Live Share Welcome to this Visual Studio Live Share Play by Play with Pluralsight. I'm Brice Wilson, and I'm going to sit down with Pluralsight author and longtime Visual Studio expert, Scott Allen, and do some pair programming with Live Share. And so here's the scenario. I have a project where I want some help from Brice when I'm writing this code because I'm not too familiar with it. Or maybe I am familiar with it, but Brice just knows the business a little bit better. So the question is, I want Brice to be able to look over my shoulder while I'm writing code, and I want to be able to ask some questions and figure out if I'm doing things correctly. But we all know that having someone sitting right beside you looking over your shoulder isn't always possible. So what happens if Brice is 3000 miles away, or what happens if Brice is actually in the same hallway as me with the same company but we just don't want to set up a meeting somewhere in some shared office or move around? I just want Brice to be able to see what I'm doing, what I'm editing, hopefully participate even in my debugging sessions if I have to step through code. So what's the best way to do that? Well, as developers we've tried screen sharing things in the past, but they're not really that well. That don't work that well. Not always ideal, right? And it's always nice to have your own editor too. Correct. My own editor, my own settings, the colors I'm used to, all the shortcuts and extensions that I use is good. And I don't know how many code reviews you've ever been in where someone else is driving the screen, and you just want to see something that's a little bit off-screen, like you just want them to scroll up a little bit. And it's frustrating not to be able to look around. These are all problems that Visual Studio Live Share can help get rid of. Essentially, if you want to do pair programming, if you want someone to be able to literally or figuratively look over your shoulder while you're programming, then Visual Studio Live Share is a tool that you have to look at.
Collaborating with Visual Studio So what we're working with is a project that is a simple ASP.NET Core application. Actually, I'm going to run it quick without the debugger just to make sure it's working locally here on my machine. I'm actually going to get Brice involved when I run an application the next time. And, ultimately, what I want to do in this project is the business has come to me and they told me that we need a new rule before we just approve loans. We need you to plug a new rule into the system. And so over here in Visual Studio, what I want to do is open up an interface definition, the ILoanQualificationRule, and just check with Brice if I am looking at the right place to start. And I have not touched my machine, and I'm now seeing the file that you just opened there. Excellent. That's pretty cool. It's kind of interesting since you are actually sitting beside me. I can scroll up and down in this file, and I can see my cursor moving on your screen. And on my screen as you are jumping around, it's showing me where your cursor is, and I think if you highlight some text, I can even see that. And it even has your name there. In case we have---we could have multiple collaborators too. So if we had multiple people joining our session, it even puts your name there so that I can see where each person is in the code. And that's quite useful. If I want to ask my collaborators, hey, am I looking at the right interface definition, and I highlight that--- I can see it's highlighted on my screen, and it's very easy to make sure we're talking about the same thing even though, again, we may be thousands of miles away.
Collaborating with Visual Studio Code Let's take a look at another scenario with Visual Studio Live Share. This time, I've got my Mac, switched away from the PC, and I'm running Visual Studio Code, and I've got a Node in Express server application with an Angular front end. It's just a demo app I've used in some of my other Pluralsight courses. But let me see if I can share that with you on your Windows machine and have you work on that, help me work on that inside Visual Studio. Sure. Sounds good? So we're going from Code to Visual Studio. Right, and a Mac to a Windows machine. Right, and now I'm in an environment where I haven't installed most of the stuff that you need for Node and Angular. Right, Node and Express and Angular and all the rest. So I am going to go to the Live Share extension I've got installed inside of Code and click the Start collaboration session link. And we can see it starting down there in the lower right corner. It's copied the link for me, so I will jump back over to teams and paste in that link and send that to you. I'm going to click on the link. That's going to open up in Visual Studio. I've already authenticated on this machine a few times, so I don't think it's going to prompt me to authenticate. But, again, all the connections are authenticated users. And I just got a notification on my screen that you've joined the session. Perfect, and I can see your folder structure. So I can see you have package.json. I know it's a Node project.