Running a .NET Core project on a Mac with .NET 6.0 installed causes a strange error.
lukepuplett#Lukes-Air > ~/Documents/Git/Repo/src/Corp.App.Mvc > > master ± > dotnet run Corp.App.Mvc.csproj
A fatal error occurred. The required library libhostfxr.dylib could not be found.
If this is a self-contained application, that library should exist in [/Users/lukepuplett/Documents/Git/Repo/src/Corp.App.Mvc/bin/Debug/net5.0/].
If this is a framework-dependent application, install the runtime in the global location [/usr/local/share/dotnet/x64] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].
The .NET runtime can be found at:
- https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=osx.11.1-x64&apphost_version=5.0.12
Note that the project builds fine.
macOS Monterey, Apple Silicon M1 and .NET 6.0 is installed.
This can occur when the project is targeting an older .NET Core version. The error is confusing because the project may build okay, and you'd expect a more accurate message.
A better message can be seen when executing the compiled binary directly, see below.
lukepuplett#Lukes-Air > ~/Documents/Git/Repo/src/Corp.App.Mvc/bin/Debug/net5.0 > > master ± > dotnet Corp.App.Mvc.dll
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:
6.0.0 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=5.0.0&arch=arm64&rid=osx.11.1-arm64
The problem can happen when you've pulled down code from a Git repo that is targeting .NET Core 5, for example.
Related
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.
Some example code I'm playing with informs me that I need ASP.NET Core Runtime 2.1.14. I found it here. I'm on macOS and there is no installer, so I downloaded the "binaries" at the link "x64" under the heading "ASP.NET Core Runtime 2.1.14" on the right. I extracted the compressed folder, called "aspnetcore-runtime-2.1.14-osx-x64", which has the following contents:
dotnet
host
LICENSE.txt
shared
ThirdPartyNotices.txt
Now, I haven't the foggiest idea what I should do with these to install ASP.NET Core Runtime 2.1.14. Could someone please tell me what I should do?
To build and run ASP.NET Core apps on macOS, you need to install the SDK which also contains the runtime. There's an installer for that on the page you linked.
You can check the installed SDKs using dotnet --list-sdks and see where are they located. Same goes for the runtimes with dotnet --list-runtimes. The .NET CLI chooses the SDK version for each dotnet command, so in your case it will pick the one compatible with the version specified in your project. By default, it would use the latest.
There is an installer for MacOS on the download page for 2.1 you visited:
Make sure to download the SDK (it includes the Runtime) in the column Installers, not Binaries.
Then install it as any MacOS application. Once you did it, you can type dotnet --version in a terminal and it will return the version you just installed.
We are currently having issues with AzureDevops hosted build servers when trying to build our application.
This is the following error we get:
MTOUCH : error MT2101: Can't resolve the reference 'System.Void
ObjCRuntime.Runtime::ReleaseBlockOnMainThread(System.IntPtr)',
referenced from the method 'System.Void
ObjCRuntime.Trampolines/NIDCompletionHandler::Finalize()' in
'Xamarin.iOS, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=84e04ff9cfb79065'.
[/Users/vsts/agent/2.155.1/work/4/s/Smartphone/......]
We have determined that this is an issue regarding the Xamarin.iOS SDK Version that the Build server is using. When running locally on Xamarin.iOS SDK 12.14.0.114, the build completes fine.
Is there anyway to specify which version an AzureDevOps server uses? I know you can use something similar to :
/bin/bash -c "sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_18_1"
/bin/bash -c "echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_10.1.app;sudo xcode-select --switch /Applications/Xcode_10.1.app/Contents/Developer"
In order to change the Mono version. What we really need is a way to select the iOS SDK version.
You can install newer iOS SDK versions using the Boots tool.
Just install it, add the step to your pipeline and put in the installer uri you need.
The download uri is https://dl.xamarin.com/MonoTouch/Mac/xamarin.ios-13.8.2.2.pkg (obviously switch to whatever Xamarin.iOS version you require).
By selecting the Mono version via the Bash script above (select-xamarin-sdk.sh), you set the corresponding Xamarin.iOS SDK version as well. If you use the latest Mono version (6.8.0 at this writing), you set the recent Xamarin.iOS SDK version at the same time.
See James Montemagno's blog entry about this.
Unity3D, a popular game engine, packages a version of mono (and monodevelop) with its install. Recently I installed Xamarin Studio, keen to play with it. Later I followed some online guides for building unity's SLN files via the command line from the sln's directory:
/Applications/Unity/MonoDevelop.app/Contents/MacOS/mdtool build -t:Build
I got this error:
Rewriting config files...
Corlib not in sync with this runtime: expected corlib version 636, found 96.
Loaded from: /Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/2.10.2/lib/mono/2.0/mscorlib.dll
Download a newer corlib or a newer runtime at http://www.go-mono.com/daily.
I figured that Xamarin Studio had brought a new mono runtime with it, and that was version 636. The mdtool I was running expected verison 96, because Unity ships with an older version of mono (.net 3.5 I think?).
So I uninstalled Xamarin Studio, and re-installed Unity to hopefully overwrite the mono runtime with the old version. Still get the error.
I notice above that the mscorlib.dll is not pulled from Frameworks/Mono.framework/Versions/Current, but 2.10.2. Why is that? How can I make this build work? Any more information I can give you?
I have installed Mono 2.10.8 (that should have .NET 4 support) and MonoDevelop 2.8.6.4 on Mac OS X 10.7.3.
I created a new project, but now the IDE displays this error: Error: Framework 'Mono / .NET 4.0' not installed. (Project name).
What do I need to do in order to be able to compile the project?
As suggested, I post this as answer:
MonoDevelop has to be restarted after it updated itself to work with the new .NET 4 features.