ApplicationPath does not return the exported application path when running on Linux/WSL

Yo!

When making use of ApplicationPath in a Linux console app, the value it returns is not the one you’d expect.

When running in the editor is all good as expected, but when running in WSL it returns /home/user/.net. Here’s an app meant to be exported and executed on Linux.
It prints the value of ApplicationPath. I came up with a workaround using BaseDirectory from System.Runtime which returns the path of the executable. When running in the IDE that obviously does not work, but using a Switch with IsExported in my app does the trick.

Repro steps :

  • Press F10 and build the app, it’ll end up in a /exports folder next to the patch
  • Fire up WSL
  • Install .NET 8 there if have not already :
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel LTS
echo 'export DOTNET_ROOT=$HOME/.dotnet' >> ~/.bashrc
echo 'export PATH=$PATH:$HOME/.dotnet' >> ~/.bashrc
source ~/.bashrc
  • cd to the directory where your app was exported
  • dotnet ReproApplicationPathLinux.dll

Expected behavior would be : Application Path and Base Directory should have the same value.

(By the way, the Microsoft tutorial linked in the Gray Book to install dotnet won’t work with recent vvvv versions. For whatever reason they’re suggesting to install the STS channel, which installs .NET7. Using --channel LTS as in the command I wrote above correctly installs .NET8)

Thanks in advance!

seb

repro_applicationpath_linux.zip (3.3 KB)

have you also tried the self-contained export option? i could imagine that makes a difference.

Thanks, fixed in upcoming.

2 Likes