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
DiffEngine
Enables simple verification of complex models and documents.
46
DiffEngine
Enables simple verification of complex models and documents.
47
DiffEngine
Enables simple verification of complex models and documents.
48
DiffEngine
Enables simple verification of complex models and documents.
50
DiffEngine
Enables simple verification of complex models and documents.
51
DiffEngine
Enables simple verification of complex models and documents.
54
DiffEngine
Enables simple verification of complex models and documents.
56
DiffEngine
Enables simple verification of complex models and documents.
57
DiffEngine
Enables simple verification of complex models and documents.
63
DiffEngine
Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.
48
DiffEngine
Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.
51
DiffEngine
Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.
53
DiffEngine
Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.
56

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 7 11/13/2024
9.0.0-rc.2.24474.4 12 10/15/2024
9.0.0-rc.1.24452.1 9 09/14/2024
9.0.0-preview.7.24405.2 11 08/15/2024
9.0.0-preview.6.24327.6 10 07/10/2024
9.0.0-preview.5.24306.8 13 06/21/2024
9.0.0-preview.4.24267.11 12 05/23/2024
9.0.0-preview.3.24175.3 27 04/17/2024
9.0.0-preview.2.24128.10 16 03/14/2024
9.0.0-preview.1.24081.3 12 02/23/2024
8.0.11 4 11/14/2024
8.0.10 12 10/15/2024
8.0.8 8 08/13/2024
8.0.7 7 07/16/2024
8.0.6 7 05/30/2024
8.0.5 9 05/16/2024
8.0.4 14 04/15/2024
8.0.3 15 03/13/2024
8.0.2 13 02/22/2024
8.0.1 10 02/07/2024
8.0.0 18 11/15/2023
8.0.0-rc.2.23479.10 16 10/19/2023
8.0.0-rc.1.23420.5 19 09/23/2023
8.0.0-preview.7.23376.1 22 09/05/2023
8.0.0-preview.6.23329.4 10 07/12/2023
8.0.0-preview.5.23302.2 27 06/18/2023
8.0.0-preview.4.23260.1 32 05/17/2023
8.0.0-preview.3.23174.8 43 04/24/2023
8.0.0-preview.2.23128.3 55 05/27/2023
8.0.0-preview.1.23110.8 21 06/21/2023
7.0.6 10 03/13/2024
7.0.5 15 09/23/2023
7.0.4 19 09/11/2023
7.0.3 12 06/21/2023
7.0.1 38 05/14/2023
7.0.0 25 05/27/2023
7.0.0-rc.2.22472.3 77 12/08/2022
7.0.0-rc.1.22426.10 23 09/22/2022
7.0.0-preview.7.22375.6 58 09/21/2022
7.0.0-preview.6.22324.4 90 09/22/2022
7.0.0-preview.5.22301.12 30 09/22/2022
7.0.0-preview.4.22229.4 40 09/22/2022
7.0.0-preview.3.22175.4 87 09/23/2022
7.0.0-preview.2.22152.2 51 09/22/2022
7.0.0-preview.1.22076.8 65 09/23/2022
6.0.9 5 11/13/2024
6.0.8 10 03/13/2024
6.0.7 17 09/11/2023
6.0.6 12 06/21/2023
6.0.4 41 06/21/2023
6.0.3 24 06/07/2023
6.0.2 21 05/15/2023
6.0.2-mauipre.1.22102.15 22 09/22/2022
6.0.2-mauipre.1.22054.8 22 09/22/2022
6.0.1 24 01/10/2023
6.0.0 51 05/09/2023
6.0.0-rc.2.21480.5 25 07/31/2023
6.0.0-rc.1.21451.13 34 09/22/2022
6.0.0-preview.7.21377.19 39 09/21/2022
6.0.0-preview.6.21352.13 44 09/26/2022
6.0.0-preview.5.21301.5 48 09/24/2022
6.0.0-preview.4.21253.7 78 09/22/2022
6.0.0-preview.3.21201.4 16 09/22/2022
6.0.0-preview.2.21154.6 64 09/21/2022
6.0.0-preview.1.21102.12 24 09/11/2023
5.0.2 41 09/21/2022
5.0.1 56 09/25/2022
5.0.0 83 09/23/2022
5.0.0-rc.2.20475.5 81 09/22/2022
5.0.0-rc.1.20451.14 54 09/21/2022
5.0.0-preview.8.20407.11 16 09/22/2022
5.0.0-preview.7.20364.11 71 09/23/2022
5.0.0-preview.6.20305.6 52 09/25/2022
5.0.0-preview.5.20278.1 26 09/27/2022
5.0.0-preview.4.20251.6 28 09/25/2022
5.0.0-preview.3.20214.6 44 09/22/2022
5.0.0-preview.2.20160.6 33 09/22/2022
5.0.0-preview.1.20120.5 81 09/22/2022
3.1.5 8 02/22/2024
3.1.4 26 06/21/2023
3.1.2 26 09/26/2022
3.1.1 36 09/26/2022
3.1.0 11 09/23/2022
3.1.0-preview3.19551.4 26 09/21/2022
3.1.0-preview2.19523.17 36 09/25/2022
3.1.0-preview1.19504.10 27 09/24/2022
3.0.1 14 09/21/2022
3.0.0 33 09/26/2022
3.0.0-rc1.19456.4 26 09/22/2022
3.0.0-preview9.19421.4 76 09/22/2022
3.0.0-preview9.19416.11 69 01/15/2023
3.0.0-preview8.19405.3 65 09/23/2022
3.0.0-preview7.19362.9 31 09/23/2022
3.0.0-preview6.19303.8 24 09/22/2022
3.0.0-preview6.19264.9 72 12/18/2022
3.0.0-preview5.19224.8 89 09/22/2022
3.0.0-preview4.19212.13 35 05/15/2023
2.1.1 35 09/24/2022
2.1.0-preview3.19128.7 44 09/22/2022
2.1.0-preview.19073.11 10 09/21/2022
2.1.0-preview.18571.3 36 09/21/2022
2.0.1 19 09/21/2022
2.0.0 16 09/11/2023
2.0.0-rc1 78 09/22/2022
2.0.0-preview2-26406-04 15 09/23/2022
2.0.0-preview1-26216-02 28 09/21/2022
2.0.0-preview1-25914-04 66 09/23/2022