AppleAppSiteAssociation.AspNet 1.0.0

dotnet add package AppleAppSiteAssociation.AspNet --version 1.0.0
                    
NuGet\Install-Package AppleAppSiteAssociation.AspNet -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AppleAppSiteAssociation.AspNet" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AppleAppSiteAssociation.AspNet" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AppleAppSiteAssociation.AspNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AppleAppSiteAssociation.AspNet --version 1.0.0
                    
#r "nuget: AppleAppSiteAssociation.AspNet, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AppleAppSiteAssociation.AspNet@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AppleAppSiteAssociation.AspNet&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AppleAppSiteAssociation.AspNet&version=1.0.0
                    
Install as a Cake Tool

AppleAppSiteAssociation

A implementation library + demo for Apple App Site Association using .NET

Usage

Install-Package AppleAppSiteAssociation.AspNet

// Add Apple App Site Association services
builder.Services.AddAppleAppSiteAssociation(cfg =>
{
    cfg.AppLinks.AddAppLink(
    [
        "ABCDE12345.com.example.app",
        "ABCDE12345.com.example.app.dev"
    ], new AppleAppSiteAssociationAppLinkComponentOptions
    {
        Fragment = "no_universal_links",
        Exclude = true,
        Comment = "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
    });
    
    // OR

    List<AppleAppSiteAssociationAppLinkComponentOptions> components = new()
    {
        new AppleAppSiteAssociationAppLinkComponentOptions
        {
            Path = "/buy/*",
            Comment = "Matches any URL with a path that starts with /buy/."
        },
        new AppleAppSiteAssociationAppLinkComponentOptions
        {
            Path = "/help/website/*",
            Exclude = true,
            Comment = "Matches any URL with a path that starts with /help/website/ and instructs the system not to open it as a universal link."
        },
        new AppleAppSiteAssociationAppLinkComponentOptions
        {
            Path = "/help/*",
            Query = { { "articleNumber", "?????" } },
            Comment = "Matches any URL with a path that starts with /help/ and also contains the query parameter articleNumber."
        }
    };
    
    cfg.AppLinks.AddAppLink(
        new[]
        {
            "ABCDE12345.com.example.app",
            "ABCDE12345.com.example.app.dev"
        }, components);
    
    // Optional: Set the web credentials
    cfg.WebCredentials = ["ABCDE12345.com.example.app", "ABCDE12345.com.example.app.dev"];
    
    // Optional: Set the app clip IDs
    cfg.AppClips = ["ABCDE12345.com.example.app.Clip", "ABCDE12345.com.example.app.Clip.dev"];
    
    // Optional: Set the cache duration for the Apple App Site Association file
    cfg.CacheDuration = TimeSpan.FromDays(1);
});
// Add the middleware to the pipeline
app.UseAppleAppSiteAssociation();

Apple App Site Association file will be available at /.well-known/apple-app-site-association

{
    "applinks": {
        "details": [
            {
                "appIDs": [
                    "ABCDE12345.com.example.app",
                    "ABCDE12345.com.example.app.dev"
                ],
                "components": [
                    {
                        "#": "no_universal_links",
                        "?": {},
                        "comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link",
                        "exclude": true
                    }
                ]
            },
            {
                "appIDs": [
                    "ABCDE12345.com.example.app",
                    "ABCDE12345.com.example.app.dev"
                ],
                "components": [
                    {
                        "/": "/buy/*",
                        "?": {},
                        "comment": "Matches any URL with a path that starts with /buy/."
                    },
                    {
                        "/": "/help/website/*",
                        "?": {},
                        "comment": "Matches any URL with a path that starts with /help/website/ and instructs the system not to open it as a universal link.",
                        "exclude": true
                    },
                    {
                        "/": "/help/*",
                        "?": {
                            "articleNumber": "?????"
                        },
                        "comment": "Matches any URL with a path that starts with /help/ and also contains the query parameter articleNumber."
                    }
                ]
            }
        ]
    },
    "webcredentials": {
        "apps": [
            "ABCDE12345.com.example.app",
            "ABCDE12345.com.example.app.dev"
        ]
    },
    "appclips": {
        "apps": [
            "ABCDE12345.com.example.app.Clip",
            "ABCDE12345.com.example.app.Clip.dev"
        ]
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 315 8/28/2024

Initial release