Brows.Win32.Interop.Operations 1.0.0

dotnet add package Brows.Win32.Interop.Operations --version 1.0.0
                    
NuGet\Install-Package Brows.Win32.Interop.Operations -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.Operations" 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.Operations" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Brows.Win32.Interop.Operations" />
                    
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.Operations --version 1.0.0
                    
#r "nuget: Brows.Win32.Interop.Operations, 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.Operations@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.Operations&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Brows.Win32.Interop.Operations&version=1.0.0
                    
Install as a Cake Tool

Brows.Win32.Interop.Operations

Batch file operations through the Windows Shell IFileOperation API. Queue copies, moves, creates, deletes, and renames against a directory, then execute the batch on an STA worker.

Install

dotnet add package Brows.Win32.Interop.Operations

This package depends on Brows.Win32.Interop and Brows.Operations. It targets .NET Framework 4.6.2 and 4.8, and .NET 8 and 10 on Windows. It must run on Windows.

Copy a file

using Brows.Threading;
using Brows.Win32;
using Brows.Win32.Win32FileOperations;
using System.Threading;

string sourceFilePath = @"C:\Data\report.txt";
string destinationDirectory = @"C:\Archive";
var pool = new STAThreadPool("file-operations");
try {
    var batch = new Win32FileOperation(destinationDirectory, pool);
    batch.CopyFiles.Add(new CopyFile { Path = sourceFilePath });
    bool hadWork = await batch.Operate(progress: null, token: CancellationToken.None);
}
finally {
    pool.Empty();
}

Directory is the destination for CopyFiles, MoveFiles, and CreateFiles, and the containing directory for DeleteFiles and RenameFiles. CopyFile and MoveFile use source paths; DeleteFile uses Name; RenameFile uses OldName and NewName; CreateFile uses Name and Attributes.

The Operate result is false for an empty batch and true when a nonempty batch reaches native execution; it does not report the result of each item. Errors are surfaced by the returned task. The cancellation token is checked before and during queueing and at Shell progress callbacks. Work runs on the supplied STAThreadPool, which the caller owns.

Options such as Silent, NoConfirmation, RenameOnCollision, and RecycleOnDelete control Windows Shell behavior. With the default Silent = false, Windows can show its own progress UI. To receive progress through IOperationProgress, set Silent = true and pass a progress receiver to Operate. For batches created through the Composition export, configure the Shell UI owner window with Win32InteropServicesVariable.OnGetOwnerWindow before the export creates its services. See the Composition README for setup. The callback runs on the STA worker during Operate and must not synchronously wait on a thread that could be waiting for the batch.

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

Package Downloads
Brows.Win32.Interop.Composition

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 48 10/5/2026