Brows.Win32.Interop
1.1.0
See the version list below for details.
dotnet add package Brows.Win32.Interop --version 1.1.0
NuGet\Install-Package Brows.Win32.Interop -Version 1.1.0
<PackageReference Include="Brows.Win32.Interop" Version="1.1.0" />
<PackageVersion Include="Brows.Win32.Interop" Version="1.1.0" />
<PackageReference Include="Brows.Win32.Interop" />
paket add Brows.Win32.Interop --version 1.1.0
#r "nuget: Brows.Win32.Interop, 1.1.0"
#:package Brows.Win32.Interop@1.1.0
#addin nuget:?package=Brows.Win32.Interop&version=1.1.0
#tool nuget:?package=Brows.Win32.Interop&version=1.1.0
Brows.Win32.Interop
Windows Shell and file-system interop for .NET. This package provides higher-level services for Shell execution, shortcut resolution, file identity, stored path casing, and directory case-sensitivity 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);
string storedPath = kernel.GetStoredPath(@"C:\DATA\REPORT.TXT");
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.
GetStoredPath returns an absolute path with the stored casing of each existing file or directory component beneath the volume or share root. Relative paths are resolved against the current directory, while the root spelling is retained from that resolved path. The path and its components must exist and be accessible; invalid paths throw ArgumentException, and native lookup failures throw Win32Exception.
Short (8.3) names expand to their stored long names. Native lookups of ordinary drive and UNC paths support long
paths without requiring the host's Win32 long-path opt-in; managed runtime path-validation settings still apply.
Explicit extended paths (\\?\C:\... or \\?\UNC\server\share\...) retain their prefix and Windows semantics:
use backslashes and omit . and .. navigation. Bare device objects are rejected with ArgumentException.
Alternate data streams are unsupported; an ordinary ADS path throws NotSupportedException on .NET Framework
and a native lookup failure throws Win32Exception. Paths exceeding the runtime's permitted length throw
PathTooLongException.
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 | Versions 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. |
-
.NETFramework 4.6.2
- Brows.Win32.STAThreadPool (>= 1.2.2)
- Domore.Logs (>= 10.6.4)
- Microsoft.CSharp (>= 4.7.0)
-
.NETFramework 4.8
- Brows.Win32.STAThreadPool (>= 1.2.2)
- Domore.Logs (>= 10.6.4)
- Microsoft.CSharp (>= 4.7.0)
-
net10.0-windows7.0
- Brows.Win32.STAThreadPool (>= 1.2.2)
- Domore.Logs (>= 10.6.4)
-
net8.0-windows7.0
- Brows.Win32.STAThreadPool (>= 1.2.2)
- Domore.Logs (>= 10.6.4)
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.