Gapotchenko.Shields.Canonical.Snap.Resolution 2025.3.2

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

Gapotchenko.Shields.Canonical.Snap.Resolution

License NuGet

The resolution module of the Gapotchenko Shield for Canonical Snap. This module provides package resolution services for Canonical Snap, allowing you to resolve file paths to their actual locations within Snap packages.

Overview

The resolution module enables you to resolve file paths that are managed by Canonical Snap packages. When Snap packages install executables, they often create symbolic links in system directories (like /usr/bin) that point to the actual executables within the Snap package directories. This module helps you find the real file paths inside Snap packages, even when accessed through these symbolic links.

Features

  • Path Resolution: Resolves symbolic links to find actual file locations within Snap packages
  • Snap Detection: Automatically detects if a file is managed by a Snap package
  • Transparent Fallback: Returns the original path if the file is not managed by Snap

Usage

Resolving File Paths

The primary functionality is provided by the GetRealFilePath method:

using Gapotchenko.Shields.Canonical.Snap.Resolution;

// Resolve a file path that might be managed by Snap
string filePath = "/usr/bin/dotnet";
string realPath = SnapResolution.GetRealFilePath(filePath);

Console.WriteLine($"Original path: {filePath}");
Console.WriteLine($"Real path: {realPath}");

// If dotnet is installed via Snap, realPath might be something like:
// "/snap/dotnet-sdk/123/usr/share/dotnet/dotnet".
// Otherwise, GetRealFilePath function returns the original path.

Handling Non-Existent Files

The method handles non-existent files gracefully:

string nonExistentPath = "/usr/bin/nonexistent";
string resolved = SnapResolution.GetRealFilePath(nonExistentPath);
// Returns the original path if the file doesn't exist

How It Works

  1. Symbolic Link Resolution: The module follows symbolic links to find the final target
  2. Snap Detection: It checks if the resolved path points to the Snap executable (snap)
  3. Package Identification: It finds the associated Snap package
  4. Manifest Lookup: It reads the snap.yaml package manifest file to find the actual file path within the package

Platform Support

  • Linux: Full support. Resolves paths for Snap packages installed on Linux systems.
  • macOS: Placeholder implementation (Snap can be installed on macOS but cannot be realistically used yet).
  • Windows: Snap cannot be installed on Windows. The resolution operation returns the original path unchanged.

API Reference

SnapResolution

Main entry point for package resolution operations.

  • GetRealFilePath(string?) - Gets the real path of a file managed by Canonical Snap package manager. If the file is not managed by Snap, returns the original file path.

Installation

Gapotchenko.Shields.Canonical.Snap.Resolution module is available as a NuGet package:

dotnet package add Gapotchenko.Shields.Canonical.Snap.Resolution
  • Deployment - Deployment discovery services (this module depends on it)
  • Management - Package management operations (this module depends on it)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 is compatible.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2025.3.2 106 12/27/2025
2025.3.1 91 12/27/2025