Meziantou.Framework.Win32.PerceivedType 2.0.19

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

Meziantou.Framework.Win32.PerceivedType

A .NET library for determining a file's perceived type based on its extension using Windows APIs.

Usage

This library provides functionality to get a file's perceived type (text, image, audio, video, etc.) based on its extension by querying the Windows registry and using the AssocGetPerceivedType Win32 API.

Get Perceived Type

using Meziantou.Framework.Win32;

// Get perceived type for a file extension
var perceived = Perceived.GetPerceivedType(".txt");
Console.WriteLine(perceived.PerceivedType); // Text
Console.WriteLine(perceived.PerceivedTypeSource); // SoftCoded or HardCoded

// Works with various file types
var image = Perceived.GetPerceivedType(".jpg");
Console.WriteLine(image.PerceivedType); // Image

var video = Perceived.GetPerceivedType(".mp4");
Console.WriteLine(video.PerceivedType); // Video

var audio = Perceived.GetPerceivedType(".mp3");
Console.WriteLine(audio.PerceivedType); // Audio

Add Custom Perceived Types

You can add custom perceived types or override system-defined types:

// Add a custom perceived type
Perceived.AddPerceived(".myext", PerceivedType.Text);

// Add default perceived types for common extensions
Perceived.AddDefaultPerceivedTypes();

Perceived Types

The library supports the following perceived types:

  • Text - Text files (.txt, .cs, .html, .xml, etc.)
  • Image - Image files (.jpg, .png, .gif, etc.)
  • Audio - Audio files (.mp3, .wav, etc.)
  • Video - Video files (.mp4, .avi, .mpeg, etc.)
  • Compressed - Compressed files (.zip, .rar, etc.)
  • Document - Document files (.doc, .pdf, etc.)
  • Application - Application files (.exe, .dll, etc.)
  • System - System files
  • GameMedia - Game media files
  • Contacts - Contact files
  • Custom - Custom type defined in registry
  • Unspecified - No perceived type
  • Unknown - Unknown type

Perceived Type Source

The PerceivedTypeSource enum indicates where the perceived type information comes from:

  • Undefined - No perceived type was found
  • SoftCoded - Determined through registry association
  • HardCoded - Inherently known to the OS
  • NativeSupport - Determined through OS codec
  • GdiPlus - Supported by GDI+
  • WmSdk - Supported by Windows Media SDK
  • ZipFolder - Supported by Windows compressed folders
  • Mime - Determined through MIME content types

Platform Support

This library is Windows-only and requires Windows XP or later (Windows 5.1.2600+).

Additional Resources

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.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
2.0.19 32 4/25/2026
2.0.18 123 1/25/2026
2.0.17 169 12/14/2025
2.0.16 226 12/7/2025
2.0.15 129 11/30/2025
2.0.14 159 11/23/2025
2.0.13 148 11/16/2025
2.0.12 162 11/9/2025
2.0.11 153 11/2/2025
2.0.10 204 10/27/2025
2.0.9 157 10/26/2025
2.0.8 133 10/19/2025
2.0.7 329 9/16/2025
2.0.6 223 9/3/2025
2.0.5 178 3/1/2025
2.0.4 162 11/17/2024
2.0.3 337 11/15/2023
2.0.2 575 7/14/2021
2.0.1 512 4/22/2021
2.0.0 607 9/24/2020
Loading failed