Microsoft.Windows.Compatibility 9.0.0
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 simple verification of complex models and documents.
|
52 |
Verify
Enables verification of complex models and documents.
|
51 |
Verify
Enables verification of complex models and documents.
|
49 |
Verify
Enables verification of complex models and documents.
|
48 |
Verify
Enables verification of complex models and documents.
|
47 |
Verify
Enables simple verification of complex models and documents.
|
46 |
Verify
Enables verification of complex models and documents.
|
44 |
Verify
Enables verification of complex models and documents.
|
43 |
Verify
Enables simple verification of complex models and documents.
|
43 |
Verify
Enables simple verification of complex models and documents.
|
42 |
Verify
Enables verification of complex models and documents.
|
41 |
Verify
Enables verification of complex models and documents.
|
40 |
Verify
Enables verification of complex models and documents.
|
39 |
Verify
Enables simple verification of complex models and documents.
|
39 |
.NET 8.0
- Microsoft.Win32.Registry.AccessControl (>= 9.0.0)
- System.Security.Cryptography.Xml (>= 9.0.0)
- System.Security.Permissions (>= 9.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.ProtectedData (>= 9.0.0)
- System.ServiceModel.Syndication (>= 9.0.0)
- System.Speech (>= 9.0.0)
- System.Text.Encoding.CodePages (>= 9.0.0)
- System.Threading.AccessControl (>= 9.0.0)
- System.Web.Services.Description (>= 4.10.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- System.Security.AccessControl (>= 6.0.0)
- System.Security.Principal.Windows (>= 5.0.0)
- System.ServiceProcess.ServiceController (>= 9.0.0)
- System.Security.Cryptography.Pkcs (>= 9.0.0)
- System.Runtime.Caching (>= 9.0.0)
- System.Reflection.Context (>= 9.0.0)
- Microsoft.Win32.SystemEvents (>= 9.0.0)
- System.CodeDom (>= 9.0.0)
- System.ComponentModel.Composition (>= 9.0.0)
- System.ComponentModel.Composition.Registration (>= 9.0.0)
- System.Configuration.ConfigurationManager (>= 9.0.0)
- System.Data.Odbc (>= 9.0.0)
- System.Data.OleDb (>= 9.0.0)
- System.Data.SqlClient (>= 4.8.6)
- System.Diagnostics.EventLog (>= 9.0.0)
- System.Diagnostics.PerformanceCounter (>= 9.0.0)
- System.DirectoryServices (>= 9.0.0)
- System.DirectoryServices.AccountManagement (>= 9.0.0)
- System.DirectoryServices.Protocols (>= 9.0.0)
- System.Drawing.Common (>= 9.0.0)
- System.IO.Packaging (>= 9.0.0)
- System.IO.Ports (>= 9.0.0)
- System.Management (>= 9.0.0)
.NET Standard 2.0
- System.Security.Cryptography.ProtectedData (>= 9.0.0)
- System.Security.Cryptography.Xml (>= 9.0.0)
- System.Security.Permissions (>= 9.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.Security.Cryptography.Pkcs (>= 9.0.0)
- System.ServiceModel.Primitives (>= 4.10.0)
- System.ServiceModel.Syndication (>= 9.0.0)
- System.ServiceProcess.ServiceController (>= 9.0.0)
- System.Speech (>= 9.0.0)
- System.Text.Encoding.CodePages (>= 9.0.0)
- System.Threading.AccessControl (>= 9.0.0)
- System.Web.Services.Description (>= 4.10.0)
- System.ServiceModel.Security (>= 4.10.0)
- System.Security.Cryptography.Cng (>= 5.0.0)
- System.Security.AccessControl (>= 6.0.0)
- System.Runtime.Caching (>= 9.0.0)
- System.Data.OleDb (>= 9.0.0)
- System.Data.SqlClient (>= 4.8.6)
- System.Diagnostics.EventLog (>= 9.0.0)
- System.Diagnostics.PerformanceCounter (>= 9.0.0)
- System.DirectoryServices (>= 9.0.0)
- System.DirectoryServices.AccountManagement (>= 9.0.0)
- System.DirectoryServices.Protocols (>= 9.0.0)
- System.Drawing.Common (>= 9.0.0)
- System.IO.FileSystem.AccessControl (>= 5.0.0)
- System.IO.Packaging (>= 9.0.0)
- System.IO.Pipes.AccessControl (>= 5.0.0)
- System.IO.Ports (>= 9.0.0)
- System.Management (>= 9.0.0)
- System.Reflection.Context (>= 9.0.0)
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.ILGeneration (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
- System.Data.Odbc (>= 9.0.0)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Configuration.ConfigurationManager (>= 9.0.0)
- System.ComponentModel.Composition (>= 9.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- Microsoft.Win32.Registry.AccessControl (>= 9.0.0)
- Microsoft.Win32.SystemEvents (>= 9.0.0)
- System.CodeDom (>= 9.0.0)
.NET Standard 2.1
- Microsoft.Win32.Registry (>= 5.0.0)
- Microsoft.Win32.Registry.AccessControl (>= 9.0.0)
- Microsoft.Win32.SystemEvents (>= 9.0.0)
- System.ComponentModel.Composition (>= 9.0.0)
- System.Security.Cryptography.Pkcs (>= 9.0.0)
- System.Security.Cryptography.ProtectedData (>= 9.0.0)
- System.Security.Cryptography.Xml (>= 9.0.0)
- System.Security.Permissions (>= 9.0.0)
- System.Security.Principal.Windows (>= 5.0.0)
- System.ServiceModel.Duplex (>= 4.10.0)
- System.ServiceModel.Http (>= 4.10.0)
- System.Security.Cryptography.Cng (>= 5.0.0)
- System.ServiceModel.NetTcp (>= 4.10.0)
- System.ServiceModel.Security (>= 4.10.0)
- System.ServiceModel.Syndication (>= 9.0.0)
- System.ServiceProcess.ServiceController (>= 9.0.0)
- System.Speech (>= 9.0.0)
- System.Text.Encoding.CodePages (>= 9.0.0)
- System.Threading.AccessControl (>= 9.0.0)
- System.Web.Services.Description (>= 4.10.0)
- System.ServiceModel.Primitives (>= 4.10.0)
- System.Security.AccessControl (>= 6.0.0)
- System.Runtime.Caching (>= 9.0.0)
- System.Reflection.Context (>= 9.0.0)
- System.ComponentModel.Composition.Registration (>= 9.0.0)
- System.Configuration.ConfigurationManager (>= 9.0.0)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Data.Odbc (>= 9.0.0)
- System.Data.OleDb (>= 9.0.0)
- System.Data.SqlClient (>= 4.8.6)
- System.Diagnostics.EventLog (>= 9.0.0)
- System.Diagnostics.PerformanceCounter (>= 9.0.0)
- System.DirectoryServices (>= 9.0.0)
- System.DirectoryServices.AccountManagement (>= 9.0.0)
- System.DirectoryServices.Protocols (>= 9.0.0)
- System.Drawing.Common (>= 9.0.0)
- System.IO.FileSystem.AccessControl (>= 5.0.0)
- System.IO.Packaging (>= 9.0.0)
- System.IO.Pipes.AccessControl (>= 5.0.0)
- System.IO.Ports (>= 9.0.0)
- System.Management (>= 9.0.0)
- System.CodeDom (>= 9.0.0)
.NET 9.0
- Microsoft.Win32.Registry.AccessControl (>= 9.0.0)
- Microsoft.Win32.SystemEvents (>= 9.0.0)
- System.CodeDom (>= 9.0.0)
- System.ComponentModel.Composition (>= 9.0.0)
- System.ServiceModel.NetTcp (>= 4.10.0)
- System.ServiceModel.Primitives (>= 4.10.0)
- System.ServiceModel.Security (>= 4.10.0)
- System.ServiceModel.Syndication (>= 9.0.0)
- System.ServiceProcess.ServiceController (>= 9.0.0)
- System.Speech (>= 9.0.0)
- System.Text.Encoding.CodePages (>= 9.0.0)
- System.ServiceModel.Http (>= 4.10.0)
- System.Threading.AccessControl (>= 9.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- System.Security.AccessControl (>= 6.0.0)
- System.Security.Principal.Windows (>= 5.0.0)
- System.Web.Services.Description (>= 4.10.0)
- System.ServiceModel.Duplex (>= 4.10.0)
- System.Security.Permissions (>= 9.0.0)
- System.DirectoryServices.AccountManagement (>= 9.0.0)
- System.Data.Odbc (>= 9.0.0)
- System.Data.OleDb (>= 9.0.0)
- System.Data.SqlClient (>= 4.8.6)
- System.Diagnostics.EventLog (>= 9.0.0)
- System.Diagnostics.PerformanceCounter (>= 9.0.0)
- System.DirectoryServices (>= 9.0.0)
- System.Security.Cryptography.Xml (>= 9.0.0)
- System.Configuration.ConfigurationManager (>= 9.0.0)
- System.DirectoryServices.Protocols (>= 9.0.0)
- System.IO.Packaging (>= 9.0.0)
- System.IO.Ports (>= 9.0.0)
- System.Management (>= 9.0.0)
- System.Reflection.Context (>= 9.0.0)
- System.Runtime.Caching (>= 9.0.0)
- System.Security.Cryptography.Pkcs (>= 9.0.0)
- System.Security.Cryptography.ProtectedData (>= 9.0.0)
- System.Drawing.Common (>= 9.0.0)
- System.ComponentModel.Composition.Registration (>= 9.0.0)