Brows.Win32.Windows 1.1.0

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

Brows.Win32.Windows

Brows.Win32.Windows is a Windows-only .NET library for retrieving file and folder previews through the Windows Shell. It provides asynchronous services for Shell icons, thumbnails, and effective icon overlays, returning WPF BitmapSource objects.

Features

  • Retrieve thumbnails through IShellItemImageFactory, with cache-only and thumbnail-generation fallbacks.
  • Retrieve path-specific, file-type, and Windows stock icons.
  • Retrieve the effective Shell overlay icon for a file or folder path.
  • Run Shell COM work on STA worker threads so callers can await the operations from a WPF UI.
  • Return frozen BitmapSource instances when possible so they can be used across threads.

Requirements

  • Windows, with WPF available.
  • The repository targets net462, net48, net8.0-windows, and net10.0-windows.
  • The repository's global.json selects the .NET 10 SDK feature band for builds.

Install

After the package has been published to a NuGet feed, add it to a project with:

dotnet add package Brows.Win32.Windows

To consume the source from this repository, add a project reference:

<ProjectReference Include="path/to/source/Brows.Win32.Windows/Brows.Win32.Windows.csproj" />

Brows.Win32.Windows.Composition is a companion NuGet package for applications using Brows.Composition. It exports IWin32WindowsServices, which forwards icon, overlay, and thumbnail requests to the services in this library. The optional Win32WindowsServicesVariable supplies a caller-owned STA thread pool; otherwise the export creates a shared pool when first used. See the Composition package README for lifecycle details.

Usage

The services expose Task-based APIs. Await them instead of synchronously blocking a WPF dispatcher with .Wait() or .Result.

using Brows.Win32;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;

public async Task LoadPreviewsAsync(
    string path,
    CancellationToken cancellationToken,
    Win32ThumbnailService thumbnailService,
    Win32OverlayService overlayService) {

    BitmapSource thumbnail = await thumbnailService.GetThumbnailSource(
        path,
        width: 320,
        height: 240,
        cancellationToken: cancellationToken);

    BitmapSource overlay = await overlayService.GetOverlayIconSource(
        path,
        token: cancellationToken);

    // Assign the results to WPF Image.Source properties, for example.
}

Win32ThumbnailService.GetThumbnailSource accepts a file or folder path and positive width and height. It first tries a cached thumbnail, then requests a thumbnail, and finally asks the Shell for a resized image. Shell errors may be reported as exceptions.

Win32OverlayService.GetOverlayIconSource asks SHGetFileInfoW for the overlay index selected by the Shell, then retrieves that overlay image from the system image list. It returns null when the Shell reports no overlay for the path.

Cancellation and disposal

Pass a CancellationToken to any service to cancel work that has not started and to observe cancellation at supported checkpoints. A token cannot interrupt a Shell COM call that is already running.

Win32IconService, Win32OverlayService, and Win32ThumbnailService implement IDisposable. Dispose them after outstanding requests have completed. Disposal is synchronous and waits for active work, so from a WPF UI use an asynchronous shutdown path and keep the dispatcher alive while disposal completes. For example:

using System.Threading.Tasks;

// After outstanding requests are complete:
await Task.Run(() => {
    iconService.Dispose();
    thumbnailService.Dispose();
    overlayService.Dispose();
});

Each service creates an STA worker pool unless one is supplied to its constructor. Disposal empties only a pool created by the service; a supplied pool remains owned by the caller.

Build and sample

Build the solution on Windows:

dotnet build brows-win32-windows.slnx

Run the WPF sample app:

dotnet run --project samples/Brows.Win32.Windows.Sample/Brows.Win32.Windows.Sample.csproj

The sample lets you enter or browse to a path and view the icon, thumbnail, and overlay returned by the Shell.

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed.  net10.0-windows7.0 is compatible. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Brows.Win32.Windows:

Package Downloads
Brows.Win32.Windows.Composition

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 0 10/1/2026
1.0.1 31 10/1/2026
1.0.0 37 9/30/2026