Where should I put ASP.NET Core Runtime binaries? - macos

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.

Related

dotnet run x.csproj "... libhostfxr.dylib could not be found."

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.

AzureDevops Build fails due to Xamarin iOS SDK version

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.

How do I build the Mono MDK on mac OS X?

I'm using Xamarin studio to write some C# code on OS X, but I upgraded my computer to OS X 10.11 (El Capitan) developer preview 3, which breaks mono
As per some of the instructions in those threads, I've compiled mono from source, and it appears to work (I can run mono on the command line, etc), however Xamarin studio does not launch because I don't have Mono.framework in my /Library/Frameworks path. I foolishly uninstalled and tried (and failed) when I first discovered Xamarin not working.
I've looked all over, and I've found plenty of instructions for how to compile Mono itself (done) but nothing which tells me how to build and install Mono.framework
I've also tried installing the Mono MDK from the package, then overwriting it's binaries with my custom built ones, but when I do this Xamarin studio fails to launch telling me I don't have the Mono MDK installed.
Can anyone help me out? Thanks
Unfortunately it doesn't appear there is a repo available to build/compile the framework from source. The current Mono MDK package located here only contains the Mono.framework along with the supporting install/uninstall scripts, etc.; current version:
MonoFramework-MDK-4.0.2.5.macos10.xamarin.x86.pkg
The Mono.framework should install to /Library/Frameworks.
If that is indeed the one you've downloaded and installed I would then verify that it has copied the Mono.framework bundle (571.6 MB) into the frameworks directory, open up Console.app then launch Xamarin. If Xamarin doesn't launch again then I would recommend posting the error message here and proceed from there.
Another option is extract the Mono.framework out of the .pkg and manually install it.
You might already have found a solution, but in case somebody else finds this thread; Mono has made a preview version that supports El Capitan:
http://www.mono-project.com/download/

Corlib not in sync when building Unity games with mdtool in OSX

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?

Using private frameworks for QT in xcode 4.3

The Mac QT Installer puts its shared libraries under /Library/Frameworks/QtXXX.Framework.
I'm building a QT application using a qmake-generated xcode project. I'd like to add these frameworks as private framewords inside my app bundle for easy deployment.
I've tried various options for doing this but I don't seem to be able to make it work. What I did -
change the Qt framework files in /Library/Frameworks/ using install_name_tool as described here
copy the these framework bundles manually to inside the app bundle
recompiling the bundle.
When I change the name of the original framework so it would appear that it's not there, the app crashes and says that it doesn't find the needed framework. What am I doing wrong?
Using xcode 4.3 on OSX 10.7.3
Some options to deploy a Qt application on Mac:
Qt comes with the macdeployqt tool, to bundle Qt with the built app bundle. The tool is a bit limited though and might or might not do what you want.
CMake comes with DeployQt4, which can also be used for deployment only, in case one doesn't want to use cmake for the build as well.
One can write his own script using install_name_tool as described in your link. If it doesn't work, check with otool -L if you replaced all absolute paths in the executable and bundled libraries. You will have to fix the paths for the bundled libraries, too! (recursively, so to say).
The latest released cmake version (2.8.7) doesn't support XCode 4.3 properly though: Since Xcode 4.3, files previously being installed to /Developer are now in /Applications/Xcode.app/Contents/Developer. cmake still expects them in /Developer. That is fixed in cmake master but not released yet. A workaround is to create a symlink:
ln -s /Applications/Xcode.app/Contents/Developer /Developer

Resources