SmushSharp 1.0.2

dotnet add package SmushSharp --version 1.0.2
                    
NuGet\Install-Package SmushSharp -Version 1.0.2
                    
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="SmushSharp" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmushSharp" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="SmushSharp" />
                    
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 SmushSharp --version 1.0.2
                    
#r "nuget: SmushSharp, 1.0.2"
                    
#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 SmushSharp@1.0.2
                    
#: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=SmushSharp&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=SmushSharp&version=1.0.2
                    
Install as a Cake Tool

SmushSharp - Simple macOS URL Scheme Handler

A minimal C# wrapper for Smush—a tiny Objective-C shim that lets a .NET 8 app detect custom URL-scheme launches on macOS (x64).


Prerequisites

  • macOS with the Xcode command-line tools installed:
    xcode-select --install
    
  • .NET 8 SDK (for dotnet build / pack / run).

Compilation

Build the native shim & C# library From the src/SmushSharp folder:

dotnet build -c Release

You can find the output in bin/Release/net8.0


Installing the NuGet package

Once you’ve packed, you can install the nuget package like this:

# from your own .NET app folder
dotnet add package SmushSharp --version 1.0.0 --source .

Usage

Register your URL scheme in your Info.plist (inside your .app bundle):

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLName</key>
    <string>com.yourcompany.yourapp</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>your-custom-scheme</string>
    </array>
  </dict>
</array>

Call DetectLaunchUrl early in your Main:

using SmushSharp;

class Program
{
    static void Main(string[] args)
    {
        // Wait up to 1 seconds for a URL
        string? launchUrl = UrlDetector.DetectLaunchUrl(2.0);
        // Your code to handle the URL ...
    }
}

Run your app:

  • Launch your app normally so that macOS can register the URL scheme. If necessary, you can manually register the URL scheme by running:
    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f <yourAppPath>.app
    
  • If you now launch via open your-custom-scheme://foo, the URL will be relayed into your C# callback.

Product Compatible and additional computed target framework versions.
.NET 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.
  • 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.2 166 7/24/2025
1.0.1 214 7/23/2025