Microsoft.Dism
4.0.7
dotnet add package Microsoft.Dism --version 4.0.7
NuGet\Install-Package Microsoft.Dism -Version 4.0.7
<PackageReference Include="Microsoft.Dism" Version="4.0.7" />
<PackageVersion Include="Microsoft.Dism" Version="4.0.7" />
<PackageReference Include="Microsoft.Dism" />
paket add Microsoft.Dism --version 4.0.7
#r "nuget: Microsoft.Dism, 4.0.7"
#:package Microsoft.Dism@4.0.7
#addin nuget:?package=Microsoft.Dism&version=4.0.7
#tool nuget:?package=Microsoft.Dism&version=4.0.7
Managed DismApi Wrapper
This is a managed wrapper for the native Deployment Image Servicing and Management (DISM) API.
This assembly allows .NET developers to call directly into the DismApi without having to shell out to Dism.exe. This allows for better integration and richer errors.
Runtime Requirements
The DISM API files are available in all Windows® 8 operating systems. You can also run DISM API applications on any Windows operating system that is supported by the Windows ADK. You must install the Windows ADK in order to run DISM API applications on these operating systems. For more information about supported operating systems, see the Windows® Assessment and Deployment Kit (Windows ADK) Technical Reference.
Getting Started
Install the NuGet package:
<ItemGroup>
<PackageReference Include="Microsoft.Dism" Version="<version>" />
</ItemGroup>
The wrapper is as close to the native DismApi as possible. Most methods in the DismApi class should mirror the functions in the DismApi. Managed classes are used in place of the native structs and I tried to keep the property names the same. I also included XML doc comments on every class, method, and property which should help with development.
Initializing DISMAPI
You'll need to initialize the DismApi first (don't forget to call Shutdown() at the end of your program)
DismApi.Initialize(DismLogLevel.LogErrors);
DismApi.Shutdown();
List Images
An example on how to list the images contained in a WIM file:
// Path to the WIM file
string imagePath = @"C:\image.wim";
// Initialize the DismApi
DismApi.Initialize(DismLogLevel.LogErrors);
try
{
// Get the images in the WIM
DismImageInfoCollection imageInfos = DismApi.GetImageInfo(imagePath);
// Print the image path and image count
Console.WriteLine("Image {0} contains {1} image(s)", imagePath, imageInfos.Count);
// Loop through each image
foreach(DismImageInfo imageInfo in imageInfos)
{
// Print the image index and name
Console.WriteLine("Image Index: {0}", imageInfo.ImageIndex);
Console.WriteLine("Image Name: {0}", imageInfo.ImageName);
Console.WriteLine("------------------------");
}
}
finally
{
// Shut down the DismApi
DismApi.Shutdown();
}
Mounting Images
An example on how to mount an image, list the features, and unmount it:
string imagePath = @"C:\image.wim";
string mountPath = @"C:\temp\mount";
int imageIndex = 1;
// Initialize the DismApi
DismApi.Initialize(DismLogLevel.LogErrors);
try
{
// Create the mount dir if it doesn't exit
if(Directory.Exists(mountPath) == false)
{
Directory.Create(mountPath);
}
// Mount the image
DismApi.MountImage(imagePath, mountPath, imageIndex);
// Open a session to the mounted image
using(DismSession session = DismApi.OpenOfflineSession(mountPath))
{
// Get the features of the image
DismFeatureCollection features = DismApi.GetFeatures(session);
// Loop through the features
foreach(DismFeature feature in features)
{
// Print the feature name
Console.WriteLine("Feature: {0}", feature.FeatureName);
}
}
// Unmount the image and discard changes
DismApi.UnmountImage(mountPath, false);
}
finally
{
// Shut down the DismApi
DismApi.Shutdown();
}
Using DismProgressCallback
DismProgressCallback is a delegate that receives progress updates during certain operations.
static void Main(string[] args)
{
DismApi.Initialize(DismLogLevel.LogErrors);
try
{
using (DismSession session = DismApi.OpenOnlineSession())
{
List<string> sourcePaths = new List<string>();
DismApi.AddCapability(
session,
capabilityName: "Capability",
limitAccess: false,
sourcePaths: new List<string>(),
progressCallback: HandleProgress,
userData: null);
}
}
finally
{
DismApi.Shutdown();
}
}
private static void HandleProgress(DismProgress progress)
{
// Print the current progress
//
Console.WriteLine("Current: {0}", progress.Current);
Console.WriteLine("Total: {0}", progress.Total);
if (progress.Current == 50)
{
// Cancel the operation at 50%
//
progress.Cancel = true;
}
}
Contributing
Please read the Contributing doc for information on building the code and contributing to the project.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.0
- No dependencies.
-
.NETStandard 2.0
- Microsoft.Win32.Registry (>= 5.0.0)
-
net8.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Microsoft.Dism:
| Package | Downloads |
|---|---|
|
TXQ.Utils
Package Description |
|
|
Redpoint.KubernetesManager
Implements a Kubernetes manager, which can provision and set up Kubernetes on Windows, macOS and Linux machines. |
GitHub repositories (9)
Showing the top 9 popular GitHub repositories that depend on Microsoft.Dism:
| Repository | Stars |
|---|---|
|
lostindark/DriverStoreExplorer
Driver Store Explorer
|
|
|
redcode-labs/easyWSL
Create WSL distros based on Docker Images.
|
|
|
Fs00/Win10BloatRemover
Configurable CLI tool to easily and aggressively debloat and tweak Windows 10 by removing preinstalled UWP apps, services and more. Originally based on the W10 de-botnet guide made by @adolfintel.
|
|
|
container-desktop/container-desktop
Provides an alternative for Docker for Desktop on Windows using WSL2.
|
|
|
CodingWonders/MicroWin
The future home of MicroWin.
|
|
|
t-richards/chemo
Remove pre-installed junk from Windows 10.
|
|
|
RedpointGames/uet
UET (Unreal Engine Tool) makes building and testing Unreal Engine projects and plugins easy. It can distribute builds with BuildGraph, remotely execute automation tests on device and across multiple machines, handles fault tolerance and automatic retries and generally makes the whole experience of automating Unreal Engine a lot more pleasant.
|
|
|
ProjectCeleste/Celeste.Launcher
|
|
|
FuseCP/FuseCP
Multi Server Control Panel for Windows based on C#
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.7 | 7,451 | 1/6/2026 |
| 4.0.0 | 2,929 | 11/17/2025 |
| 3.3.12 | 8,770 | 5/28/2025 |
| 3.3.0 | 19,642 | 12/10/2024 |
| 3.2.0 | 195 | 12/9/2024 |
| 3.1.0 | 23,967 | 2/5/2024 |
| 3.0.0 | 6,792 | 11/3/2023 |
| 2.5.2 | 15,933 | 6/30/2022 |
| 2.4.0 | 12,053 | 9/27/2021 |
| 2.3.1 | 527 | 9/27/2021 |
| 2.2.2 | 9,627 | 3/1/2021 |
| 2.1.10 | 10,005 | 9/15/2020 |
| 2.1.9 | 1,679 | 6/16/2020 |
| 2.1.6 | 834 | 5/14/2020 |
| 2.1.4 | 2,251 | 3/10/2020 |
| 2.0.23 | 932 | 3/4/2020 |
| 2.0.22 | 812 | 2/27/2020 |
| 2.0.21 | 1,300 | 1/6/2020 |