[WSL 2] The hostname could not be parsed. (Unable to load .csproj from inside WSL)
Build number: Microsoft Windows [Version 10.0.18932.1000]
- What you're doing and what's happening: (Copy&paste the full set of specific command-line steps necessary to reproduce the behavior, and their output. Include screen shots if that helps demonstrate the problem.)
Added .NET Framework projects inside the WSL file system per the recommendation for increased speed. Opened the solutions in Visual Studio 2019. Projects does not load. I have mapped my Ubuntu.18.04 to a network drive.
- What's wrong / what should be happening instead:
The projects in the solution does not load. They should load.
- Strace of the failing command, if applicable: (If
some_commandis failing, then runstrace -o some_command.strace -f some_command some_args, and link the contents ofsome_command.stracein a gist here).
Error message: error : The project file could not be loaded. Invalid URI: The hostname could not be parsed. \wsl$\Ubuntu-18.04\home\rasolo\dev{project}/.csproj.
Someone else opened an identical issue in the VSCode repo here but for .NET Core: https://github.com/OmniSharp/omnisharp-vscode/issues/3099
~~This problem is solved in build version: Microsoft Windows [Version 10.0.18936.1000]~~
~~It works for a Web forms project but not for ASP.NET web project.~~
If I open the .sln without mapped network drive, I will receive the "The hostname could not be parsed." error. If I map the network drive, Visual Studio can not find WSL
"Workaround": Map WSL to Network drive and then open the solution file with JetBrains Rider. BUT it is excruciatingly slow to restore nuget packages and compile so it is not really worth it.
I was able to reproduce this issue, we're tracking it! Thanks for filing.
Not sure i'm competent enought here, the workaround is to map the drive from wsl to windows ? or the other way ?
I would very much love to know if/how i can do that so i would be able to add it to the ~/.zshrc (if it's on wsl side)
Not sure i'm competent enought here, the workaround is to map the drive from wsl to windows ? or the other way ?
I would very much love to know if/how i can do that so i would be able to add it to the
~/.zshrc(if it's on wsl side)
What I did was this: Open WSL interface. Write cd and enter (to go to root) Explorer.exe to open folder in file explorer. Click on Wsl in file explorer Right click the Ubuntu folder and click "Map to network drive".
This made it possible to open the project in Jetbrains Rider IDE but it took like 20 minutes for Rider to compile so it doesn't really work to use it like that, hence "workaround"
@rasolo wow thx a lot i feel dumb now i though it was on the linux side ;)
i ended up doing the other way around i forgot i could just use the tar package , following zip install for linux
mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-2.2.401-linux-x64.tar.gz -C $HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
then update my .zshrc with
export PATH=$PATH:$HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
I was able to reproduce this issue, we're tracking it! Thanks for filing.
Hi Craig, @craigloewen-msft Do you know the progress of this? Do you know an ETA for when this will work?
Thanks
Currently the Visual Studio team is investigating how they can enable Visual Studio to open project files inside of the Linux root file system in WSL, I'm not aware of an ETA yet.
In the meantime, using VSCode with the Remote Extension may go a long way to resolving this problem for you.
By mapping the network drive I am able to open the project inside Visual Studio. Building is slow, as expected, but otherwise everything else seems functional.
Is there any new information on this issue? Or a link to a public issue for the Visual Studio team?
I found a nice workaround:
Create a soft symlink to the target directory e.g.: mklink /D D:\shareLink \wsl$\etc
Then create a symlink junction to the soft symlink: mklink /J D:\junctionLink D:\shareLink
You can now open D:\junctionLink\etc in VS and it should load everything as usual. Speed should be fine aswell. @rasolo @TheLordDrake @summatix Let me know if it works for you.
would this official extension work ? https://marketplace.visualstudio.com/items?itemName=ms-azuretools.Dot-Net-Core-Debugging-With-Wsl2
It's a preview one, but I suppose that will somehow be the target
October 2020, I still unable to load projects from WSl2, with the latest VS version and the .NET Core Debugging with WSL 2 extension installed too, any hint or help would be appreciated.

@tebeco's workaround works as a temporary solution for me
which msg are you referring to as a workaround ?
the remote dev pack is the official set of extensions for docker / ssh / wsl etc... it's not supposed to be a workaround ^^
My mistake I tagged the wrong user, I meant to reference @drwatson85's symlink solution.
I wanted my repos to be located on the linux filesystem but still be able to open them in visual studio. That solution worked for me for now.
I am still having issues running Azure Functions this way but at least I can have all my source code in one places and still use Visual Studio when VS Code is not enough.
@rawrspace @josemojena @drwatson85 @summatix

Vs 2019 16.9 Preview 5 ==> .Net Core Debugging in WSL 2
(thx @andreandersen / @jcotton42 for pointing that up)
I installed vs 2019 16.9 preview 5 but when opening a project that is on the linux filesystem I still receive an error when opening a database .sqlproj file:

It looks like opening a normal console .csproj worked though but when trying to run it I got:

Are you not seeing these issues?