question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.NET Core SDK not found on WSL2 when using alias for binary

See original GitHub issue

Issue Type: Bug

I am using WSL2 (Ubuntu) and would like to share some (hoping all) of the tooling across Windows and WSL to limit the number of different versions of binaries I need to maintain. This is possible by either:

  • adding an alias to the ~/.bash_aliases file if the binary is installed in Windows and needs to be used in WSL
  • executing wsl mycommand if the binary is in WSL and needs to be executed in Windoes I opted for the first option.

To reproduce:

  1. Install WSL2 distribution
  2. Install .NET Core SDK in Windows
  3. Install C# extension in the WSL2 instance of VSCode
  4. Launch WSL2 distribution and add the following to ~/.bash_aliases:
alias dotnet="dotnet.exe"
  1. Launch VSCode and open a project in WSL2 containing a dotnet app
  2. The extension complains about not finding teh sdk binary, but running dotnet --version in the terminal yields the expected result (prints the version)

Extension version: 1.23.15 VS Code version: Code 1.60.0 (e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff, 2021-09-01T10:41:52.311Z) OS version: Windows_NT x64 10.0.19043 Restricted Mode: No Remote OS version: Linux x64 5.10.16.3-microsoft-standard-WSL2

System Info
Item Value
CPUs Intel® Core™ i7-1065G7 CPU @ 1.30GHz (8 x 1498)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.60GB (16.22GB free)
Process Argv –crash-reporter-id 90574aaf-8f00-4c7c-b56a-746b56209f47
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu
OS Linux x64 5.10.16.3-microsoft-standard-WSL2
CPUs Intel® Core™ i7-1065G7 CPU @ 1.30GHz (8 x 1497)
Memory (System) 24.74GB (20.83GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
pythonvspyt700cf:30270857
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30300192
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805:30301674
pythonvspyt200:30340761
vscextlang:30333561
binariesv615:30325510
vsccppwtct:30329789
pythonvssor306:30344512
bridge0708:30335490
pygetstartedt2:30360495
bridge0723:30353136
pythonf5test824cf:30361778
vsdyn321cf:30356811
pythonvspyt187:30362782
pydsgst2:30361792
vscus224cf:30358040
vssid140cf:30362081

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
JoeRobichcommented, Sep 20, 2021

@esune Sorry we couldn’t get this to work. This isn’t a supported scenario, but thought there might be a chance to get it partially working. Our recommendation is to install the .NET SDK in both your Windows and WSL environments. Closing.

1reaction
JoeRobichcommented, Sep 8, 2021

@esune Sorry I meant setting up the necessary environment variables might get you closer to a working setup. In particular DOTNET_PATH.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The .NET Core SDK cannot be located · Issue #3401 - GitHub
From start menu search for "this pc", right click and select properties. · Click Advanced system settings · Click on "Environment Variables..." ...
Read more >
Where is the dotnet runtime installed to on Ubuntu?
NET Core installed for Windows, the dotnet-install.sh script recognises it and doesn't install it again.
Read more >
Debug Your .NET Core Apps in WSL 2 with Visual Studio
The library 'libhostpolicy.so' required to execute the application was not found in '/mnt/c/GIT/app/BE.App/bin/Dev/netcoreapp3.1/win-x64/'.
Read more >
Requesting automatic alias for dotnet - store - snapcraft.io
I am an application developer using the dotnet SDK to create apps ... into a binary which executes directly, not through the dotnet...
Read more >
Running .NET Core Apps under Windows Subsystem for ...
NET SDK for Linux. Go to dot.net for Linux/Ubuntu and follow the installation instructions there. To find out the Ubuntu version running, use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found