Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share

Introduction

Live Share enables your team to quickly collaborate on the same codebase without needing to synchronize code or to configure the same development tools, settings, or environment. This is an extraordinary feature from Microsoft for collaborative working.

Live Share is  currently supported in Visual Studio 2017, 2019 versions and Visual Studio Code as well.
 
In this post, we will create an ASP.NET Core web application from Visual Studio 2017 and we will edit and debug the same application from Visual Studio 2019 which is hosted in another VM.
 

Install Live Share in Visual Studio 2017

 
We can download the Live Share extension from the below URL.
 
https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsls-vs
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
You can download the Live Share extension from “Tools” -> “Extensions and Updates” also. You must search for “Live Share” keyword.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
After installing the extension, you can see the Live Share icon on the right top corner of Visual Studio.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
Please note that Live Share is pre-installed with Visual Studio 2019 version.

Create ASP.NET Core Web application with Core 2.2 version. We can choose the ASP.NET Core 2.2 version and “Web Application” template to create a new project.

Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
Our project will be ready in a few moments. We can start collaborating session and edit the code from another VM machine using Live Share.
 

Start the collaboration session

 
We can simply click the Live Share button to start the collaborate session. You can connect live share using various login options. I have chosen the External Account option.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
We can connect either with a GitHub account or Microsoft account. I am connecting with my GitHub account.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
Now, we are ready to collaborate with the codebase.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
Live Share link is automatically copied to the clipboard. (A sample URL is listed below)
https://prod.liveshare.vsengsaas.visualstudio.com/join?B76A3D63BC4196E565EE4086117C7FA33318

Join Live Share from another machine.

We can open the Visual Studio 2019 from another VM. Please select the “Join Live Share Session” option from the file menu.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
You can paste the session invite URL link to this text box and click the “Join” button to start the session in VS 2019 from VM.
 
The project is now loaded to our new machine. You can see the previous machine user details (Short Name) listed on the top right corner.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
Interestingly, you can see the new VS 2019 user details in the VS 2017 also. For differentiating two Visual Studio versions, I have chosen different themes. (One dark and one blue)
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
We can simply edit any files from VS 2019 and can see the changes immediately affected in the original file in VS 2017.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
I have made a small code change in VS 2019. It will immediately affect the original file even without saving the file!!! You can even notice the user name (another machine) as a tooltip.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
How cool this feature is? We can save the changes from VS 2019 and it will automatically save the original file in VS 2017 also.
 
If you try to debug/run the application from VS 2019 you will get the below error message.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
We haven't allowed the guest user to debug our application.
 
We can enable it from “Tools” -> “Options” menu.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
We can again try to run the application from VS 2019. It will start the build process and compile all the files. Please note, the application will be running on VS 2017 also.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 
You can run the application from VS 2017 and see that application will automatically run from VS 2019 as well.
 
Both the machines and Visual Studio versions communicate brilliantly with Live Share.
 
After all the code changes are finished from a remote machine, you can stop the Live Share option. It will be automatically detected from VS 2019 and will show below message.
 
Collaborate Work In Same Project From VS 2017 And VS 2019 Using Live Share
 

Conclusion

We have successfully edited and executed the application from a remote machine using Microsoft’s brilliant feature Live Share. It is easy for big companies to collaboratively work with the same project and save time for remote debugging. Hope you have understood the basic functionalities of Live Share. We can explore more Visual Studio 2019 features in upcoming articles. Please feel free to give your feedback about my article.


Similar Articles