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:

Feedback

We value your feedback! Here are ways to get in touch with us:

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

https://go.microsoft.com/fwlink/?LinkID=799421

.NET 8.0

.NET Standard 2.0

.NET Standard 2.1

.NET 9.0

Version Downloads Last updated
9.0.0 4 11/13/2024
9.0.0-rc.2.24474.4 3 10/26/2024
9.0.0-rc.1.24452.1 7 09/17/2024
9.0.0-preview.7.24405.2 5 08/17/2024
9.0.0-preview.6.24327.6 5 07/11/2024
9.0.0-preview.5.24306.8 7 06/27/2024
9.0.0-preview.4.24267.11 4 05/23/2024
9.0.0-preview.3.24175.3 7 04/14/2024
9.0.0-preview.2.24128.10 6 03/31/2024
9.0.0-preview.1.24081.3 5 03/11/2024
8.0.11 4 11/13/2024
8.0.10 2 10/25/2024
8.0.8 4 08/16/2024
8.0.7 7 07/10/2024
8.0.6 25 05/28/2024
8.0.5 9 05/14/2024
8.0.4 13 04/11/2024
8.0.3 11 03/29/2024
8.0.2 11 03/09/2024
8.0.1 4 01/28/2024
8.0.0 7 01/21/2024
8.0.0-rc.2.23479.10 8 01/10/2024
8.0.0-rc.1.23420.5 7 01/29/2024
8.0.0-preview.7.23376.1 4 01/10/2024
8.0.0-preview.6.23329.4 3 01/22/2024
8.0.0-preview.5.23302.2 5 01/09/2024
8.0.0-preview.4.23260.1 4 08/28/2023
8.0.0-preview.3.23174.8 7 05/15/2023
8.0.0-preview.2.23128.3 8 08/28/2023
8.0.0-preview.1.23110.8 5 08/25/2023
7.0.6 12 03/29/2024
7.0.5 9 01/08/2024
7.0.4 6 01/22/2024
7.0.3 5 01/22/2024
7.0.1 8 08/27/2023
7.0.0 5 08/28/2023
7.0.0-rc.2.22472.3 7 08/29/2023
7.0.0-rc.1.22426.10 7 09/01/2023
7.0.0-preview.7.22375.6 14 07/31/2023
7.0.0-preview.6.22324.4 4 08/27/2023
7.0.0-preview.5.22301.12 6 08/31/2023
7.0.0-preview.4.22229.4 7 08/30/2023
7.0.0-preview.3.22175.4 6 08/29/2023
7.0.0-preview.2.22152.2 5 08/28/2023
7.0.0-preview.1.22076.8 6 08/27/2023
6.0.9 4 11/13/2024
6.0.8 14 03/29/2024
6.0.7 5 01/08/2024
6.0.6 6 01/08/2024
6.0.4 5 08/31/2023
6.0.3 8 08/27/2023
6.0.2 8 08/28/2023
6.0.2-mauipre.1.22102.15 10 04/22/2024
6.0.2-mauipre.1.22054.8 4 08/27/2023
6.0.1 8 08/30/2023
6.0.0 8 08/26/2023
6.0.0-rc.2.21480.5 7 08/30/2023
6.0.0-rc.1.21451.13 6 10/12/2021
6.0.0-preview.7.21377.19 5 08/30/2023
6.0.0-preview.6.21352.13 8 08/29/2023
6.0.0-preview.5.21301.5 21 08/10/2023
6.0.0-preview.4.21253.7 5 08/30/2023
6.0.0-preview.3.21201.4 8 08/31/2023
6.0.0-preview.2.21154.6 4 02/09/2024
6.0.0-preview.1.21102.12 10 10/26/2021
5.0.2 7 05/05/2024
5.0.1 5 08/31/2023
5.0.0 9 12/30/2020
5.0.0-rc.2.20475.5 9 08/28/2023
5.0.0-rc.1.20451.14 7 08/26/2023
5.0.0-preview.8.20407.11 7 08/26/2023
5.0.0-preview.7.20364.11 6 08/29/2023
5.0.0-preview.6.20305.6 5 08/30/2023
5.0.0-preview.5.20278.1 6 08/29/2023
5.0.0-preview.4.20251.6 13 07/14/2023
5.0.0-preview.3.20214.6 9 08/26/2023
5.0.0-preview.2.20160.6 6 05/18/2023
5.0.0-preview.1.20120.5 4 07/22/2024
3.1.5 9 01/13/2024
3.1.4 7 08/28/2023
3.1.2 7 07/12/2024
3.1.1 4 08/25/2023
3.1.0 18 05/27/2023
3.1.0-preview3.19551.4 7 08/24/2023
3.1.0-preview2.19523.17 9 08/30/2023
3.1.0-preview1.19504.10 7 08/30/2023
3.0.1 16 08/24/2023
3.0.0 8 08/30/2023
3.0.0-rc1.19456.4 7 08/29/2023
3.0.0-preview9.19421.4 6 08/31/2023
3.0.0-preview9.19416.11 11 08/28/2023
3.0.0-preview8.19405.3 7 08/25/2023
3.0.0-preview7.19362.9 6 08/29/2023
3.0.0-preview6.19303.8 4 03/16/2024
3.0.0-preview6.19264.9 5 08/28/2023
3.0.0-preview5.19224.8 5 08/26/2023
3.0.0-preview4.19212.13 11 08/25/2023
2.1.1 15 08/29/2023
2.1.0-preview3.19128.7 5 08/30/2023
2.1.0-preview.19073.11 5 08/27/2023
2.1.0-preview.18571.3 5 08/31/2023
2.0.1 19 08/30/2023
2.0.0 7 09/01/2023
2.0.0-rc1 7 06/13/2023
2.0.0-preview2-26406-04 7 08/29/2023
2.0.0-preview1-26216-02 8 08/31/2023
2.0.0-preview1-25914-04 9 08/27/2023