Microsoft.Windows.Compatibility 8.0.11
Microsoft.Windows.Compatibility
The Microsoft.Windows.Compatibility
package provides Windows-specific APIs to help you port your .NET Framework applications to .NET Core 2.0+, .NET 5+ or .NET Standard. This package offers a smoother transition for those looking to modernize their applications without losing access to familiar Windows functionalities.
Getting Started
To start using the Microsoft.Windows.Compatibility
package, you'll first need to install it via NuGet Package Manager, Package Manager Console, or by editing your project file.
Usage
After installing the package, you can access Windows-specific APIs just like you would in a .NET Framework application. Below are some examples in both C# and VB:
Writing to the Windows Registry
C#
using Microsoft.Win32;
class Program
{
static void Main()
{
using (RegistryKey key = Registry.CurrentUser.CreateSubKey("Software\\MyApp"))
{
key.SetValue("MySetting", "MyValue");
}
}
}
VB
Imports Microsoft.Win32
Module Program
Sub Main()
Using key As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\MyApp")
key.SetValue("MySetting", "MyValue")
End Using
End Sub
End Module
Using the Serial Port
C#
using System.IO.Ports;
class Program
{
static void Main()
{
using (SerialPort port = new SerialPort("COM1", 9600))
{
port.Open();
port.WriteLine("Hello, world!");
}
}
}
VB
Imports System.IO.Ports
Module Program
Sub Main()
Using port As New SerialPort("COM1", 9600)
port.Open()
port.WriteLine("Hello, world!")
End Using
End Sub
End Module
Additional Documentation
For more in-depth tutorials and API references, you can check the following resources:
- Use the Windows Compatibility Pack to port code - .NET
- Announcing the Windows Compatibility Pack for .NET Core
- Installing NuGet client tools | Microsoft Learn
Feedback
We value your feedback! Here are ways to get in touch with us:
- Open an issue on our GitHub repository
- Reach out on Twitter with the hashtag #dotnet
- Join our Discord channel: dotnet/Discord
Showing the top 20 packages that depend on Microsoft.Windows.Compatibility.
Packages | Downloads |
---|---|
Verify
Enables verification of complex models and documents.
|
31 |
Verify
Enables verification of complex models and documents.
|
22 |
Verify
Enables simple verification of complex models and documents.
|
22 |
DiffEngine
Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.
|
21 |
Verify
Enables verification of complex models and documents.
|
21 |
Verify
Enables simple verification of complex models and documents.
|
21 |
Verify
Enables verification of complex models and documents.
|
20 |
Verify
Enables simple verification of complex models and documents.
|
20 |
.NET 6.0
- Microsoft.Win32.Registry.AccessControl (>= 8.0.0)
- System.ServiceModel.Primitives (>= 4.10.0)
- System.ServiceModel.Security (>= 4.10.0)
- System.ServiceModel.Syndication (>= 8.0.0)
- System.ServiceProcess.ServiceController (>= 8.0.1)
- System.Speech (>= 8.0.0)
- System.Text.Encoding.CodePages (>= 8.0.0)
- System.Threading.AccessControl (>= 8.0.0)
- System.Web.Services.Description (>= 4.10.0)
- System.ServiceModel.NetTcp (>= 4.10.0)
- System.ServiceModel.Http (>= 4.10.0)
- System.Security.Permissions (>= 8.0.0)
- System.ComponentModel.Composition (>= 8.0.0)
- System.ComponentModel.Composition.Registration (>= 8.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.1)
- System.Data.Odbc (>= 8.0.1)
- System.Data.OleDb (>= 8.0.1)
- System.Data.SqlClient (>= 4.8.6)
- System.Diagnostics.EventLog (>= 8.0.1)
- System.Diagnostics.PerformanceCounter (>= 8.0.1)
- System.DirectoryServices (>= 8.0.0)
- System.ServiceModel.Duplex (>= 4.10.0)
- System.DirectoryServices.AccountManagement (>= 8.0.1)
- System.Drawing.Common (>= 8.0.11)
- System.IO.Packaging (>= 8.0.1)
- System.IO.Ports (>= 8.0.0)
- System.Management (>= 8.0.0)
- System.Reflection.Context (>= 8.0.0)
- System.Runtime.Caching (>= 8.0.1)
- System.Security.Cryptography.Pkcs (>= 8.0.1)
- System.Security.Cryptography.ProtectedData (>= 8.0.0)
- System.Security.Cryptography.Xml (>= 8.0.2)
- System.DirectoryServices.Protocols (>= 8.0.0)
- System.CodeDom (>= 8.0.0)
- Microsoft.Win32.SystemEvents (>= 8.0.0)
.NET Standard 2.0
- System.IO.Pipes.AccessControl (>= 5.0.0)
- System.IO.Ports (>= 8.0.0)
- System.Management (>= 8.0.0)
- System.Reflection.Context (>= 8.0.0)
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.ILGeneration (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
- System.Runtime.Caching (>= 8.0.1)
- System.Security.AccessControl (>= 6.0.0)
- System.IO.Packaging (>= 8.0.1)
- System.Security.Cryptography.Cng (>= 5.0.0)
- System.Security.Cryptography.ProtectedData (>= 8.0.0)
- System.Security.Cryptography.Xml (>= 8.0.2)
- System.Security.Permissions (>= 8.0.0)
- System.Security.Principal.Windows (>= 5.0.0)
- System.ServiceModel.Duplex (>= 4.10.0)
- System.ServiceModel.Http (>= 4.10.0)
- System.ServiceModel.NetTcp (>= 4.10.0)
- System.ServiceModel.Primitives (>= 4.10.0)
- System.ServiceModel.Security (>= 4.10.0)
- System.Security.Cryptography.Pkcs (>= 8.0.1)
- System.ServiceModel.Syndication (>= 8.0.0)
- System.IO.FileSystem.AccessControl (>= 5.0.0)
- System.DirectoryServices.Protocols (>= 8.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- Microsoft.Win32.Registry.AccessControl (>= 8.0.0)
- Microsoft.Win32.SystemEvents (>= 8.0.0)
- System.Drawing.Common (>= 8.0.11)
- System.CodeDom (>= 8.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.1)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Data.Odbc (>= 8.0.1)
- System.Data.OleDb (>= 8.0.1)
- System.Data.SqlClient (>= 4.8.6)
- System.Diagnostics.EventLog (>= 8.0.1)
- System.Diagnostics.PerformanceCounter (>= 8.0.1)
- System.DirectoryServices (>= 8.0.0)
- System.DirectoryServices.AccountManagement (>= 8.0.1)
- System.ComponentModel.Composition (>= 8.0.0)
- System.ServiceProcess.ServiceController (>= 8.0.1)
- System.Text.Encoding.CodePages (>= 8.0.0)
- System.Speech (>= 8.0.0)
- System.Threading.AccessControl (>= 8.0.0)
- System.Web.Services.Description (>= 4.10.0)
.NET 8.0
- System.ServiceModel.Syndication (>= 8.0.0)
- System.ServiceProcess.ServiceController (>= 8.0.1)
- System.Speech (>= 8.0.0)
- System.Text.Encoding.CodePages (>= 8.0.0)
- System.Threading.AccessControl (>= 8.0.0)
- System.Web.Services.Description (>= 4.10.0)
- System.ServiceModel.Security (>= 4.10.0)
- System.ServiceModel.Primitives (>= 4.10.0)
- System.ServiceModel.NetTcp (>= 4.10.0)
- System.ServiceModel.Http (>= 4.10.0)
- System.Configuration.ConfigurationManager (>= 8.0.1)
- System.Data.Odbc (>= 8.0.1)
- System.Data.OleDb (>= 8.0.1)
- System.Data.SqlClient (>= 4.8.6)
- System.Diagnostics.EventLog (>= 8.0.1)
- System.Diagnostics.PerformanceCounter (>= 8.0.1)
- System.DirectoryServices (>= 8.0.0)
- System.DirectoryServices.AccountManagement (>= 8.0.1)
- System.DirectoryServices.Protocols (>= 8.0.0)
- System.ComponentModel.Composition.Registration (>= 8.0.0)
- System.Drawing.Common (>= 8.0.11)
- System.IO.Ports (>= 8.0.0)
- System.Management (>= 8.0.0)
- System.Reflection.Context (>= 8.0.0)
- System.Runtime.Caching (>= 8.0.1)
- System.Security.Cryptography.Pkcs (>= 8.0.1)
- System.Security.Cryptography.ProtectedData (>= 8.0.0)
- System.Security.Cryptography.Xml (>= 8.0.2)
- System.Security.Permissions (>= 8.0.0)
- System.ServiceModel.Duplex (>= 4.10.0)
- System.IO.Packaging (>= 8.0.1)
- System.ComponentModel.Composition (>= 8.0.0)
- Microsoft.Win32.SystemEvents (>= 8.0.0)
- System.CodeDom (>= 8.0.0)
- Microsoft.Win32.Registry.AccessControl (>= 8.0.0)
.NET Standard 2.1
- System.Reflection.Context (>= 8.0.0)
- System.Runtime.Caching (>= 8.0.1)
- System.Security.AccessControl (>= 6.0.0)
- System.Security.Cryptography.Cng (>= 5.0.0)
- System.Security.Cryptography.Pkcs (>= 8.0.1)
- System.Security.Cryptography.ProtectedData (>= 8.0.0)
- System.Security.Cryptography.Xml (>= 8.0.2)
- System.Security.Permissions (>= 8.0.0)
- System.Security.Principal.Windows (>= 5.0.0)
- System.Management (>= 8.0.0)
- System.ServiceModel.Duplex (>= 4.10.0)
- System.ServiceModel.NetTcp (>= 4.10.0)
- System.ServiceModel.Primitives (>= 4.10.0)
- System.ServiceModel.Security (>= 4.10.0)
- System.ServiceModel.Syndication (>= 8.0.0)
- System.ServiceProcess.ServiceController (>= 8.0.1)
- System.Speech (>= 8.0.0)
- System.Text.Encoding.CodePages (>= 8.0.0)
- System.Threading.AccessControl (>= 8.0.0)
- System.Web.Services.Description (>= 4.10.0)
- System.ServiceModel.Http (>= 4.10.0)
- System.IO.Ports (>= 8.0.0)
- System.IO.Packaging (>= 8.0.1)
- Microsoft.Win32.Registry (>= 5.0.0)
- Microsoft.Win32.Registry.AccessControl (>= 8.0.0)
- Microsoft.Win32.SystemEvents (>= 8.0.0)
- System.CodeDom (>= 8.0.0)
- System.ComponentModel.Composition (>= 8.0.0)
- System.ComponentModel.Composition.Registration (>= 8.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.1)
- System.IO.Pipes.AccessControl (>= 5.0.0)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Data.OleDb (>= 8.0.1)
- System.Data.SqlClient (>= 4.8.6)
- System.Diagnostics.EventLog (>= 8.0.1)
- System.Diagnostics.PerformanceCounter (>= 8.0.1)
- System.DirectoryServices (>= 8.0.0)
- System.DirectoryServices.AccountManagement (>= 8.0.1)
- System.DirectoryServices.Protocols (>= 8.0.0)
- System.Drawing.Common (>= 8.0.11)
- System.IO.FileSystem.AccessControl (>= 5.0.0)
- System.Data.Odbc (>= 8.0.1)
.NET 7.0
- System.DirectoryServices.AccountManagement (>= 8.0.1)
- Microsoft.Win32.Registry.AccessControl (>= 8.0.0)
- Microsoft.Win32.SystemEvents (>= 8.0.0)
- System.ComponentModel.Composition (>= 8.0.0)
- System.ComponentModel.Composition.Registration (>= 8.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.1)
- System.Data.Odbc (>= 8.0.1)
- System.Data.OleDb (>= 8.0.1)
- System.Data.SqlClient (>= 4.8.6)
- System.Diagnostics.EventLog (>= 8.0.1)
- System.Diagnostics.PerformanceCounter (>= 8.0.1)
- System.DirectoryServices (>= 8.0.0)
- System.CodeDom (>= 8.0.0)
- System.DirectoryServices.Protocols (>= 8.0.0)
- System.IO.Packaging (>= 8.0.1)
- System.Drawing.Common (>= 8.0.11)
- System.IO.Ports (>= 8.0.0)
- System.Management (>= 8.0.0)
- System.Reflection.Context (>= 8.0.0)
- System.Runtime.Caching (>= 8.0.1)
- System.Security.Cryptography.Pkcs (>= 8.0.1)
- System.Security.Cryptography.ProtectedData (>= 8.0.0)
- System.Security.Cryptography.Xml (>= 8.0.2)
- System.Security.Permissions (>= 8.0.0)
- System.ServiceModel.Duplex (>= 4.10.0)
- System.ServiceModel.Http (>= 4.10.0)
- System.ServiceModel.Primitives (>= 4.10.0)
- System.ServiceModel.Security (>= 4.10.0)
- System.ServiceModel.Syndication (>= 8.0.0)
- System.ServiceProcess.ServiceController (>= 8.0.1)
- System.Speech (>= 8.0.0)
- System.Text.Encoding.CodePages (>= 8.0.0)
- System.Threading.AccessControl (>= 8.0.0)
- System.Web.Services.Description (>= 4.10.0)
- System.ServiceModel.NetTcp (>= 4.10.0)