{"id":27363,"date":"2021-01-14T18:37:02","date_gmt":"2021-01-14T18:37:02","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=27363"},"modified":"2021-01-22T17:44:52","modified_gmt":"2021-01-22T17:44:52","slug":"c-with-visual-studio-and-wsl2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/c-with-visual-studio-and-wsl2\/","title":{"rendered":"C++ with Visual Studio and WSL2"},"content":{"rendered":"<p>Our team released <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/c-with-visual-studio-2019-and-windows-subsystem-for-linux-wsl\/\">native support for C++ with the Windows Subsystem for Linux (WSL) in Visual Studio<\/a> in 2019. \u201cNative support\u201d means that all commands are executed locally instead of over a SSH connection. Since then, <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/wsl\/compare-versions\">WSL2<\/a> has been announced and we\u2019ve received questions about our support for WSL2 in Visual Studio. The purpose of this blog post is to:<\/p>\n<ul>\n<li>Clarify our existing support for WSL1 and WSL2,<\/li>\n<li>Introduce our plans to add native support for WSL2,<\/li>\n<li>Gather feedback from customers who have used our native support for WSL1 in Visual Studio through this <a href=\"https:\/\/www.surveymonkey.com\/r\/L98VDF2\">two-question survey<\/a>.\u00a0<strong>Update 1\/22\/2021: This survey is now closed.<\/strong><\/li>\n<\/ul>\n<h4>Current support for WSL1 and WSL2<\/h4>\n<p>Our native support for WSL currently works best with WSL1. Our support executes all commands locally through wsl.exe and relies on Windows drives mounted under the \/mnt folder (e.g. \/mnt\/c\/Users\u2026) to access local source files from WSL. These commands are slower with WSL2 because file performance across the Windows and Linux operating systems is faster with WSL1 than WSL2. You can learn more about the differences between WSL1 and WSL2 <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/wsl\/compare-versions#exceptions-for-using-wsl-1-rather-than-wsl-2\">here<\/a>.<\/p>\n<p>To avoid these slowdowns, you can install and run SSH on your local WSL2 installation and <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/linux\/connect-to-your-remote-linux-computer?view=msvc-160&amp;viewFallbackFrom=vs-2019\">add a new SSH connection<\/a> to WSL2 in the Visual Studio Connection Manager. Learn how to install and configure SSH on your WSL installation <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/targeting-windows-subsystem-for-linux-from-visual-studio\/#install-configure-ssh\">here<\/a>.<\/p>\n<h4>Native support for WSL2<\/h4>\n<p>We are working to add native support for WSL2 in Visual Studio. This will allow you to seamlessly build and debug on WSL2 without adding a SSH connection or observing the slowdowns described above.<\/p>\n<h5><span style=\"font-size: 14pt;\">How it will work<\/span><\/h5>\n<p>Behind the scenes, Visual Studio will execute a local rsync copy to copy files from the Windows file system to the WSL2 file system. We\u2019re not able to continue accessing the mounted Windows drives from WSL (as we do with WSL1) because file performance across the Windows and Linux operating systems is slower in WSL2. This local rsync copy will occur automatically when Visual Studio detects that you are using WSL2 and will require no user intervention. You will no longer need to establish a SSH connection to avoid the slowdowns described above, and there will be no change in your ability to build and debug locally on WSL2.<\/p>\n<h4>Provide feedback on our support for WSL2<\/h4>\n<p>If you have used our native support for WSL1 in Visual Studio, then we would love your feedback on our plans for WSL2. Please submit this short, <a href=\"https:\/\/www.surveymonkey.com\/r\/L98VDF2\">two-question survey<\/a> to help us build the best features for your C++ development needs. <strong>Update 1\/22\/2021: This survey is now closed.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Our team released native support for C++ with the Windows Subsystem for Linux (WSL) in Visual Studio in 2019. \u201cNative support\u201d means that all commands are executed locally instead of over a SSH connection. Since then, WSL2 has been announced and we\u2019ve received questions about our support for WSL2 in Visual Studio. The purpose of [&hellip;]<\/p>\n","protected":false},"author":2953,"featured_media":27364,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[266,279,258],"tags":[],"class_list":["post-27363","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cmake","category-linux","category-survey"],"acf":[],"blog_post_summary":"<p>Our team released native support for C++ with the Windows Subsystem for Linux (WSL) in Visual Studio in 2019. \u201cNative support\u201d means that all commands are executed locally instead of over a SSH connection. Since then, WSL2 has been announced and we\u2019ve received questions about our support for WSL2 in Visual Studio. The purpose of [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/27363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/2953"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=27363"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/27363\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/27364"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=27363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=27363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=27363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}