From the course: Eleven Tips for the .NET Developer

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Build Linux and Windows path strings

Build Linux and Windows path strings - .NET Tutorial

From the course: Eleven Tips for the .NET Developer

Build Linux and Windows path strings

- [Narrator] One of the nice things about .NET Core is that you can create an application that'll run on multiple operating systems. So what I want to look at today is how do you get file path information in your application if you're running on Linux or Windows. So let's start by taking a look at Windows Terminal, which I have a open here. I'm in PowerShell. I'm going to be testing on Linux. I'm using Windows Subsystem for Linux. So if you don't have that installed, all you need to do is go to your PowerShell prompt and type in WSL--install. If you run this, Ubuntu is the default and then it'll install it and then I believe you have to restart Windows and you can start testing it. So once you've done that, then you'll have another prompt available here. So let's open that one. Okay, so I have navigated to a published folder over here and I'll navigate to the same folder in Linux. So we'll move up a couple directories and then we'll go to, (keyboard clicking) and then list the files…

Contents