Brows.Win32.Interop 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Brows.Win32.Interop --version 1.0.0
                    
NuGet\Install-Package Brows.Win32.Interop -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="Brows.Win32.Interop" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Brows.Win32.Interop" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Brows.Win32.Interop" />
                    
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.Interop --version 1.0.0
                    
#r "nuget: Brows.Win32.Interop, 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 Brows.Win32.Interop@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=Brows.Win32.Interop&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Brows.Win32.Interop&version=1.0.0
                    
Install as a Cake Tool

Brows.Win32.Interop

Windows Shell and file-system interop for .NET. This package provides higher-level services for Shell execution, shortcut resolution, and file identity checks, plus lower-level Win32 and COM bindings used by other Brows packages.

Install

dotnet add package Brows.Win32.Interop

The package targets .NET Framework 4.6.2 and 4.8, and .NET 8 and 10 on Windows. It calls Windows APIs and must run on Windows.

Use the services

using Brows.Win32;
using System.Threading;

string firstPath = @"C:\Data\report.txt";
string secondPath = @"C:\Data\report-link.txt";
string directoryPath = @"C:\Data";
string documentPath = firstPath;
string shortcutPath = @"C:\Data\report.lnk";

using var kernel = new Win32KernelService();
bool sameFile = kernel.PathsAreEquivalent(firstPath, secondPath);
bool caseSensitive = kernel.PathIsCaseSensitive(directoryPath);

using var shell = new Win32ShellService(threadPool: null);
await shell.ExecuteDefault(documentPath, CancellationToken.None);
string targetPath = await shell.GetLinkPath(shortcutPath, CancellationToken.None);

PathsAreEquivalent compares the identity of existing files or directories, rather than their path text. PathIsCaseSensitive queries a directory's case-sensitivity flag and returns false when the query is unsupported. Other query failures throw.

ExecuteDefault runs the default Shell verb for a path. Its overload ExecuteDefault(file, with, cancellationToken) opens file with the specified executable. ExecuteProperties opens the Properties verb. These methods return Task; await them to observe errors. Shell work runs on an STA worker. An optional cancellation token can stop work before dispatch, but cannot interrupt a native Shell call already in progress.

GetLinkPath resolves a .lnk shortcut and returns its target path, or null for a non-shortcut or a lookup failure. Cancellation is propagated. Win32ShellService can use a supplied Brows.Threading.STAThreadPool; passing null creates a pool owned by the service. Dispose the service after its operations finish.

License

MIT.

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.Interop:

Package Downloads
Brows.Win32.Interop.Operations

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 0 10/8/2026
1.1.0 0 10/8/2026
1.0.0 61 10/5/2026