csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

Csharpier fails on embeded .net versions without seting direct path to .net installation directory

Open sirdawidd opened this issue 3 years ago • 2 comments

Hello, I'm using embeded version of .net. Issue is if I don't set DOTNET_ROOT in user variables Csharpier is not discovering .net

dotnet csharpier --version A fatal error occurred. The required library hostfxr.dll could not be found. If this is a self-contained application, that library should exist in [C:\Users\ddebinski.dotnet\tools.store\csharpier\0.17.0\csharpier\0.17.0\tools\net6.0\any]. If this is a framework-dependent application, install the runtime in the global location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation].

dotnet --version 6.0.403

But if I set DOTNET_ROOT then it works, but Omnisharp fails (mainly see same error when lunch test debuger, created other ticked (https://github.com/OmniSharp/omnisharp-vscode/issues/5533)) ....

How to reproduce? Delete all installed versions of .net, download embeded, setup needed local variables, install csharpier in vscode.

I think auto discovery could be improved.

Thanks

sirdawidd avatar Jan 24 '23 09:01 sirdawidd

Thanks for the reproduction steps. I'm not exactly clear how to download an embedded version of dotnet. It isn't something I'm familiar with and my googling has failed me.

belav avatar Jan 24 '23 21:01 belav

Thanks for the reproduction steps. I'm not exactly clear how to download an embedded version of dotnet. It isn't something I'm familiar with and my googling has failed me.

On download page https://dotnet.microsoft.com/en-us/download/dotnet/7.0 simply choose Binary version. then unzip, set .net path in your environment variable (to directory you unzipped .net), and run some project.

sirdawidd avatar Jan 25 '23 12:01 sirdawidd

The latest version of the vscode extension should handle this now. It locates dotnet, and then sets DOTNET_ROOT when it runs csharpier. If it can't locate dotnet on the PATH, it respects the configurations dotnet.dotnetpath and omnisharp.dotNetCliPaths

belav avatar Feb 23 '24 16:02 belav