Getting F# working in VSCode when "dotnet" is not found on MacOSX? - macos

I'm completely new to dotnet and vscode so I might be missing something trivial. I just want to get F# running in VSCode on my Mac. I first tried installing dotnet from brew:
brew cask install dotnet-sdk
This seems to be working fine from the command line since I could do both dotnet new and dotnet build:
dotnet new console -lang F# -o myproj
Now I installed Visual Studio Code, also from brew:
brew cask install visual-studio-code
I then installed the Ionide-fsharp plugin, opened the myproj folder from vscode and restarted it. I'm then greeted with:
I then searched for FSharp.dotnetRoot in the settings and tried to configure this:
But it didn't help (I also tried setting the folder to /usr/local/share/dotnet and /usr/local/share/dotnet/sdk/3.1.100 but nothing worked).
So I completely uninstalled everything (including wiping my ~/.vscode folder) from brew and re-installed everything from the official Microsoft documentation. In the docs it says that the F# support should be built-in to vscode on macosx, but it still recommended me to install Ionide-fsharp when I opened the folder again, so I obeyed. But I just ran into exactly the same problem again.
So my question is: How can I install vscode with working F# support on MacOSX?
Here's my output from vscode "about":
Version: 1.41.0
Commit: 9579eda04fdb3a9bba2750f15193e5fafe16b959
Date: 2019-12-11T17:58:38.338Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.2.0
and this is from dotnet --info:
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.15
OS Platform: Darwin
RID: osx.10.15-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.100/
Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6db
.NET Core SDKs installed:
3.1.100 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

Related

aspnetcore not found on a mac mini m2

I was working on a .netcore project on a Mac Mini with M2 CPU.
I saved the .cs file, and the .net rebuild started (It was running with dotnet watch run).
Instead of success, I received this:
dotnet watch 🚀 Started You must install .NET to run this application.
App: /Users/xxxx/xxxx/bin/Debug/net6.0/api
Architecture: arm64 App host version: 6.0.13 .NET location: Not found
I have two SDKs installed. The output of dotnet --info
.NET SDK: Version: 7.0.102 Commit: 4bbdd14480
Runtime Environment: OS Name: Mac OS X OS Version: 13.2 OS
Platform: Darwin RID: osx.13-arm64 Base Path:
/usr/local/share/dotnet/SDK/7.0.102/
Host: Version: 7.0.2 Architecture: arm64 Commit:
d037e070eb
.NET SDKs installed:
6.0.405 [/usr/local/share/dotnet/sdk]
7.0.102 [/usr/local/share/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.13
[/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.2
[/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.13
[/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.2
[/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
The funny!! thing it happened suddenly, everything was working fine one moment, and the next, now it says .net is not installed at all.
Does anyone have a problem like this?

go darwin/arm64 SDK in the MacOS

I installed the Goland for the Apple silicon and go SDK in the macOS M1 machine. In the terminal I get -
$ go version
go version go1.18.3 darwin/amd64
When I try to debug the go application, I get the following error -
Debugging programs compiled with go version go1.18.3 darwin/amd64 are not supported. Use go SDK for darwin/arm64.
How do I install the go darwin/arm64 SDK in the MacOS?
That's because you downloaded the wrong file because there is a difference between amd64 and arm64, try downloading the arm64 version in the stable version.
ps : please try to uninstall the amd64 version before installing the arm64 version
I installed the correct version from the page -
https://go.dev/dl/

VS code does not detect .NET Core Runtime in Linux Mint

I am trying to use the Oracle Explorer extension in vscode. When I first installed it, vscode popped up this dialog asking me to install .Net Core Runtime. I followed the link and installed the SDK and runtime (Ubuntu). It seems to have installed correctly. When I type
dotnet --info
I get this output, which looks okay to me:
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: linuxmint
OS Version: 20.3
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/6.0.101/
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
.NET SDKs installed:
6.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
However, when I re-open vscode I still get the dialog telling me that the Oracle Explorer extension requires the .NET Core Runtime.
I thought it might be a problem with the $PATH variable. This is the output of $PATH:
bash: /home/jh/bin:/home/jh/packages/anaconda3/bin:/home/jh/packages/anaconda3/condabin:/home/jh/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/jh/.dotnet/tools: No such file or directory
/home/jh/.dotnet/tools does not exist. I tried adding the directories from the "dotnet --info" output to PATH but that didn't work either. I'm in uncharted territory here so that's about as far as I got.
Any help is appreciated.
The extension doesn't currently support the .NET Core Runtime 6.0 (found in an answer here).
I installed the 5.0 Runtime and everything worked fine.

.NET 5 not found in MacOS (Monterey) though it is installed

I am trying to run a project I created on .NET 5 (on another machine) on my MacOS machine running Monterey 12.1 and I got this error:
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '5.0.0' (arm64) was not found.
- The following frameworks were found:
3.1.20 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
6.0.1 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
I thought it was strange since I remembered having installed it previously, but proceeded and installed (SDK 5.0.404) it again. And got the same error.
Then went and run dotnet --list-runtimes and got the following output:
Microsoft.AspNetCore.App 3.1.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
I am totally lost. It seems even though I am installing the whole SDK package and later on tried also just with the runtime installation, my machine refuses to see it as installed.
The issue seems to be that the only version available of .NET5 for Mac is x64, and there is no ARM64 version for that version. ARM64 for Mac is only fully supported since .NET6

Target .Netcore 2.1 on Mac

How do I target .Net Core 2.1 on a Mac?
When I change the .csproj content to target netstandard2.1 I get the following error
"/usr/local/share/dotnet/sdk/2.1.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(150,5):
error : The current .NET SDKdoes not support targeting .NET Standard
2.1. Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1.
[/Users/user/Documents/Projects/vsCode/DotNet/AlexaDemo/data/data.csproj]"
Dotnet --info returns
dotnet --info .NET Core SDK (reflecting any global.json): Version:
2.1.300 Commit: adab45bf0c
Runtime Environment: OS Name: Mac OS X OS Version: 10.13 OS
Platform: Darwin RID: osx.10.13-x64 Base Path:
/usr/local/share/dotnet/sdk/2.1.300/
Host (useful for support): Version: 2.1.0 Commit: caa7b7e2ba
.NET Core SDKs installed:
2.0.0 [/usr/local/share/dotnet/sdk]
2.1.4 [/usr/local/share/dotnet/sdk]
2.1.300 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.0
[/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0
[/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.0
[/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5
[/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0
[/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I am using vsCode on Mac if that makes any difference.
Thanks
The answer is there is no dotnetstandard2.1 as of yet.
classlib projects should target NET Standard 2.0 and console, mvc and api projects should target netcoreapp2.1.
I believe targeting a specific release of dotnet Core is not available on VS or VSCode for mac. However, using Rider #jetbrains, I was able to choose the framework version when creating a new solution.
Best

Resources