XFiler.ImageOperations.Windows 10.0.1

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

FileOperations

CI License: MIT

Platform-native file operations for .NET 10 desktop apps: move to Recycle Bin / Trash, well-known user folders, logical drives and drive mount notifications — behind one set of interfaces for Windows and macOS. Used by the X-Filer file manager.

Package Target Version Downloads
XFiler.FileOperations.Abstractions net10.0 NuGet Downloads
XFiler.FileOperations.Windows net10.0-windows NuGet Downloads
XFiler.FileOperations.Mac net10.0-macos NuGet Downloads
Egorozh.Windows.ImageOperations net10.0-windows NuGet Downloads

What is inside

Interface (Abstractions) Windows macOS
IFileOperations — delete a file or folder permanently or to the Recycle Bin / Trash, list logical drives WindowsFileOperations (Shell SHFileOperation) MacOsFileOperations (NSFileManager.TrashItem, mounted volumes)
IPlatformFolders — app data, Desktop, Downloads, Documents, Movies, Music, Pictures WindowsPlatformFolders MacOsPlatformFolders
IDriveDetector — DriveChanged event when a drive is added or removed WindowsDriveDetector (WMI Win32_VolumeChangeEvent) MacOsDriveDetector (NSWorkspace mount/unmount notifications; IDisposable)

WindowsFileOperations also has static helpers that go through the Windows Shell with its own progress and confirmation UI: CopyFile/CopyFiles/CopyDirectory, MoveFile/MoveFiles/MoveDirectory, DeleteFile/DeleteFiles/DeleteDirectory and Rename*.

Egorozh.Windows.ImageOperations extracts the Shell icon of a file (ImageSystem.GetIcon, ImageSystem.GetIconStream).

Install

Reference the abstractions from shared code and the platform package from the app head:

<ItemGroup>
  <PackageReference Include="XFiler.FileOperations.Abstractions" Version="10.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0-windows'">
  <PackageReference Include="XFiler.FileOperations.Windows" Version="10.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0-macos'">
  <PackageReference Include="XFiler.FileOperations.Mac" Version="10.0.0" />
</ItemGroup>

The Windows package targets net10.0-windows, so a plain net10.0 project cannot reference it — the Windows head of the app has to target net10.0-windows too. The Mac package needs the macos workload (dotnet workload install macos).

Usage

using FileOperations.Abstractions;
using FileOperations.Abstractions.Enums;
#if MACOS
using FileOperations.MacOs;
#else
using FileOperations.Windows;
#endif

#if MACOS
IFileOperations fileOperations = new MacOsFileOperations();
IPlatformFolders folders = new MacOsPlatformFolders();
#else
IFileOperations fileOperations = new WindowsFileOperations();
IPlatformFolders folders = new WindowsPlatformFolders();
#endif

// Recycle Bin on Windows, Trash on macOS; throws if the item cannot be moved there.
fileOperations.DeleteFile(path, RecycleOption.SendToRecycleBin);
fileOperations.DeleteDirectory(folder, DeleteDirectoryOption.DeleteAllContents, RecycleOption.SendToRecycleBin);

string settingsFolder = Path.Combine(folders.GetAppDataPath(), "MyApp");

Watch for drives being plugged in or ejected:

#if MACOS
IDriveDetector detector = new MacOsDriveDetector();
#else
IDriveDetector detector = new WindowsDriveDetector();
#endif

detector.DriveChanged += (type, drive) => Console.WriteLine($"{type}: {drive}");

All packages are marked AOT-compatible.

Build

cd src
dotnet build FileOperations.sln

EnableWindowsTargeting is on, so the Windows projects also build on macOS and Linux (they only run on Windows). Building the Mac project needs macOS with Xcode and the macos workload.

Release

CI (.github/workflows/ci.yml) builds and packs the Windows packages on a Windows runner and the Mac package on a macOS runner, on every push and pull request to main. Pushing a v* tag publishes all packages to NuGet.org with the version taken from the tag (v10.0.1 → 10.0.1) through NuGet Trusted Publishing — no API key: a nuget.org trusted publishing policy for this repository and ci.yml, and the NUGET_USER repository secret (nuget.org profile name of the policy's creator).

git tag v10.0.1
git push origin v10.0.1

Changelog

10.0.0

  • Targets .NET 10: net10.0 (Abstractions), net10.0-windows (Windows, ImageOperations), net10.0-macos (Mac).
  • macOS: moving to Trash throws an IOException when it fails instead of silently doing nothing.
  • macOS: MacOsDriveDetector reports mounted and unmounted volumes (it was an empty stub).

8.0.0 — first release, .NET 8.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
10.0.1 79 10/19/2026