DevKit.Screenshot.WinUi3.Sharp 0.1.1

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

DevKit.Screenshot.WinUi3.Sharp

Main-window screenshot capture for WinUI 3 (Windows App SDK) apps — a one-liner CI hook plus a programmatic IScreenshot service. Built for CI pipelines, visual testing and dev tooling.

Quick start

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
    var cliArgs = Environment.GetCommandLineArgs().Skip(1).ToArray();
    var options = ScreenshotArgs.ParseAndRemove(ref cliArgs);   // strips --devkit-screenshot…

    _window = new MainWindow();
    _window.AttachScreenshot(options);   // captures on first activation, after render
    _window.Activate();
}

Run your app:

MyApp.exe --devkit-screenshot artifacts/shot.png --devkit-screenshot-exit --devkit-screenshot-delay 500
MyApp.exe --devkit-screenshot-clipboard --devkit-screenshot-exit

The window activates, renders, waits the settle delay, saves the PNG and (with -exit) exits. On failure the error goes to stderr and the process exits with code 70.

Without the CLI switch the hook is a no-op — ship it in production code freely.

Programmatic use

// Preferred: tell the library where your window lives.
services.AddScreenshot(_ => _window!);

// Fallback: reflection-based resolution — requires a public MainWindow property
// or the template's m_window field on your Application class.
services.AddScreenshot();

var result = await screenshot.CaptureMainWindowAsync("shot.png");

await screenshot.CaptureMainWindowToClipboardAsync();

Capture an element (panel, terminal surface, …)

var (width, height, pngBytes) = await ElementScreenshotCapture.CapturePngAsync(myBorder);
await ElementScreenshotCapture.CopyToClipboardAsync(myBorder);

Part of the DevKit.Sharp family. MIT licensed.

Product Compatible and additional computed target framework versions.
.NET net8.0-windows10.0.19041 is compatible.  net9.0-windows was computed.  net10.0-windows was computed.  net10.0-windows10.0.19041 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
0.1.2 48 8/3/2026
0.1.1 54 8/2/2026
0.1.0 55 8/2/2026