-
Notifications
You must be signed in to change notification settings - Fork 549
.NET 6
Sample projects can be found here: https://github.com/dotnet/maui-samples.
The sample project repository also contains instructions for how to install the latest preview versions.
You can create a new project by executing "dotnet new" (this will create a new macOS (Cocoa) project):
dotnet new macosFor macOS, it's possible to choose which runtime to use, either MonoVM or CoreCLR.
The default is currently MonoVM, but you can switch to CoreCLR by adding the following to your project file:
<PropertyGroup>
<UseMonoRuntime>false</UseMonoRuntime>
</PropertyGroup>If you run into any bugs, please file them here: https://github.com/xamarin/xamarin-macios/issues/new. For any kind of build problems, it's particularly helpful to get the binlog of the build. When building from the command line, you can generate a binlog by appending /bl to the command:
dotnet build /blAn msbuild.binlog file will be created, and please attach it to any issue you open.
-
Find the package for the version you want to try.
Every commit will create packages, which means that you can try whichever commit you want (assuming the commit in question actually builds, and that enough time has passed for build to complete - it usually takes 8-12 hours).
- Go to the commit in question, so for the hash fa5f323c88e6fc0441a0f282dfbc9006a5467c5d, go to https://github.com/xamarin/xamarin-macios/commit/fa5f323c88e6fc0441a0f282dfbc9006a5467c5d.
- Scroll down until you see a comment that says "Packages generated". Expand the "View packages" text, and download the "Microsoft..Bundle..pkg (notarized)" link.
If the commit in question doesn't have packages (for whatever reason), you can always look at the parent commit.
-
Identify the .NET version this package was built with.
This might not be required, if you have a close .NET version installed already it might work, but we recommend using the exact same version. There are often breaking changes that require a matching .NET install.
-
Go to the
eng/Version.Details.xmlfile for the commit in question, and get theMicrosoft.Dotnet.Sdk.Internalversion. -
Example for the commit from above: https://github.com/xamarin/xamarin-macios/blob/fa5f323c88e6fc0441a0f282dfbc9006a5467c5d/eng/Version.Details.xml#L3
-
Download the package for the .NET version in question and install it. This is a bit complicated, but it usually works to get the link for a similar version, and change just change the version in the URL.
For example:
https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.100-<version>/dotnet-sdk-6.0.100-<version>-osx-x64.pkgto
https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.100-6.0.100-rc.1.21402.7/dotnet-sdk-6.0.100-6.0.100-rc.1.21402.7-osx-x64.pkg
-
-
Add a
NuGet.configto your project directory with the following contents:<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="xamarin-impl" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" /> </packageSources> </configuration>
This is required because daily/prerelease versions aren't published to nuget.org.
Note: if you already have a
NuGet.config, you'll have to add thexamarin-implpackage source instead of replacing the existing one. -
Install the package from step 1 and corresponding workload.
-
Install the downloaded pkg from step 1 above (this has to be done after installing .NET in step 2).
-
Install the workload:
Execute:
sudo dotnet workload install <platform> --skip-manifest-update # platform = `ios`, `tvos`, `maccatalyst` or `macOS`
The
--skip-manifest-updateargument is important, otherwise .NET will update the manifests to the official ones, and you'll end up installing the official versions.
-
-
Add a
global.jsonAdd a
global.jsonwith the following content:{ "sdk": { "version": "<.NET version from step #2>" } }for example:
{ "sdk": { "version": "6.0.100-preview.7.21330.1" } } -
Build your project!
dotnet build /bl
If there are any problems, please file an issue and include the binlog file.