Skip to content

.NET daily

Rolf Bjarne Kvinge edited this page May 28, 2024 · 3 revisions

Use a daily/prerelease version

  1. 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).

    1. Go to the commit in question, so for the hash fa5f323c88e6fc0441a0f282dfbc9006a5467c5d, go to https://github.com/xamarin/xamarin-macios/commit/fa5f323c88e6fc0441a0f282dfbc9006a5467c5d.
    2. Scroll down until you see a comment that says "Packages generated". Expand the "View packages" text, and download the Microsoft.<platform>.Bundle.<version>.pkg (notarized) link.

    If the commit in question doesn't have packages (for whatever reason), you can always look at the parent commit.

    If you want a commit from the main branch, you can go here: commits in main, start at the top, and check every commit to see if it has packages.

  2. 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.

    1. Go to the eng/Version.Details.xml file for the commit in question, and get the Microsoft.Dotnet.Sdk.Internal version.

    2. Example for the commit from above: https://github.com/xamarin/xamarin-macios/blob/fa5f323c88e6fc0441a0f282dfbc9006a5467c5d/eng/Version.Details.xml#L3

    3. 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.pkg

      to

      https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.100-rc.1.21402.7/dotnet-sdk-6.0.100-6.0.100-rc.1.21402.7-osx-x64.pkg

  3. Add a NuGet.config to 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" />
        <add key="dotnet8" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet8/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 the xamarin-impl package source instead of replacing the existing one.

  4. Install the package from step 1 and corresponding workload.

    1. Install the downloaded pkg from step 1 above (this has to be done after installing .NET in step 2).

    2. Install the workload:

      Execute:

      sudo dotnet workload install <platform> --skip-manifest-update # platform = `ios`, `tvos`, `maccatalyst` or `macOS`

      The --skip-manifest-update argument is important, otherwise .NET will update the manifests to the official ones, and you'll end up installing the official versions.

  5. Add a global.json

    Add a global.json with the following content:

    {
    	"sdk": {
    		"version": "<.NET version from step #2>"
    	}
    }

    for example:

    {
    	"sdk": {
    		"version": "6.0.100-preview.7.21330.1"
    	}
    }
  6. Build your project!

    dotnet build /bl

If there are any problems, please file an issue and include the binlog file.

Clone this wiki locally