Microsoft.Windows.Compatibility 9.0.0-preview.3.24175.3

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.
28
DiffEngine
Enables simple verification of complex models and documents.
29
DiffEngine
Enables simple verification of complex models and documents.
30
DiffEngine
Enables simple verification of complex models and documents.
31
DiffEngine
Enables simple verification of complex models and documents.
32
DiffEngine
Enables simple verification of complex models and documents.
36
DiffEngine
Enables simple verification of complex models and documents.
40
DiffEngine
Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.
29
DiffEngine
Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.
30
DiffEngine
Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.
32
DiffEngine
Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.
33
DiffEngine
Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.
35

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-preview.3.24175.3 1 04/17/2024
9.0.0-preview.2.24128.10 3 03/14/2024
9.0.0-preview.1.24081.3 1 02/23/2024
8.0.4 1 04/15/2024
8.0.3 4 03/13/2024
8.0.2 1 02/22/2024
8.0.1 2 02/07/2024
8.0.0 7 11/15/2023
8.0.0-rc.2.23479.10 4 10/19/2023
8.0.0-rc.1.23420.5 4 09/23/2023
8.0.0-preview.7.23376.1 6 09/05/2023
8.0.0-preview.6.23329.4 5 07/12/2023
8.0.0-preview.5.23302.2 12 06/18/2023
8.0.0-preview.4.23260.1 19 05/17/2023
8.0.0-preview.3.23174.8 27 04/24/2023
8.0.0-preview.2.23128.3 27 05/27/2023
8.0.0-preview.1.23110.8 9 06/21/2023
7.0.6 2 03/13/2024
7.0.5 4 09/23/2023
7.0.4 6 09/11/2023
7.0.3 6 06/21/2023
7.0.1 24 05/14/2023
7.0.0 14 05/27/2023
7.0.0-rc.2.22472.3 42 12/08/2022
7.0.0-rc.1.22426.10 10 09/22/2022
7.0.0-preview.7.22375.6 29 09/21/2022
7.0.0-preview.6.22324.4 53 09/22/2022
7.0.0-preview.5.22301.12 16 09/22/2022
7.0.0-preview.4.22229.4 18 09/22/2022
7.0.0-preview.3.22175.4 49 09/23/2022
7.0.0-preview.2.22152.2 35 09/22/2022
7.0.0-preview.1.22076.8 41 09/23/2022
6.0.8 2 03/13/2024
6.0.7 5 09/11/2023
6.0.6 6 06/21/2023
6.0.4 13 06/21/2023
6.0.3 10 06/07/2023
6.0.2 12 05/15/2023
6.0.2-mauipre.1.22102.15 9 09/22/2022
6.0.2-mauipre.1.22054.8 9 09/22/2022
6.0.1 10 01/10/2023
6.0.0 30 05/09/2023
6.0.0-rc.2.21480.5 9 07/31/2023
6.0.0-rc.1.21451.13 15 09/22/2022
6.0.0-preview.7.21377.19 24 09/21/2022
6.0.0-preview.6.21352.13 24 09/26/2022
6.0.0-preview.5.21301.5 32 09/24/2022
6.0.0-preview.4.21253.7 45 09/22/2022
6.0.0-preview.3.21201.4 7 09/22/2022
6.0.0-preview.2.21154.6 43 09/21/2022
6.0.0-preview.1.21102.12 6 09/11/2023
5.0.2 23 09/21/2022
5.0.1 42 09/25/2022
5.0.0 52 09/23/2022
5.0.0-rc.2.20475.5 46 09/22/2022
5.0.0-rc.1.20451.14 29 09/21/2022
5.0.0-preview.8.20407.11 6 09/22/2022
5.0.0-preview.7.20364.11 42 09/23/2022
5.0.0-preview.6.20305.6 26 09/25/2022
5.0.0-preview.5.20278.1 12 09/27/2022
5.0.0-preview.4.20251.6 10 09/25/2022
5.0.0-preview.3.20214.6 23 09/22/2022
5.0.0-preview.2.20160.6 18 09/22/2022
5.0.0-preview.1.20120.5 43 09/22/2022
3.1.5 1 02/22/2024
3.1.4 15 06/21/2023
3.1.2 17 09/26/2022
3.1.1 24 09/26/2022
3.1.0 5 09/23/2022
3.1.0-preview3.19551.4 15 09/21/2022
3.1.0-preview2.19523.17 22 09/25/2022
3.1.0-preview1.19504.10 10 09/24/2022
3.0.1 8 09/21/2022
3.0.0 21 09/26/2022
3.0.0-rc1.19456.4 14 09/22/2022
3.0.0-preview9.19421.4 39 09/22/2022
3.0.0-preview9.19416.11 36 01/15/2023
3.0.0-preview8.19405.3 39 09/23/2022
3.0.0-preview7.19362.9 15 09/23/2022
3.0.0-preview6.19303.8 9 09/22/2022
3.0.0-preview6.19264.9 42 12/18/2022
3.0.0-preview5.19224.8 53 09/22/2022
3.0.0-preview4.19212.13 19 05/15/2023
2.1.1 22 09/24/2022
2.1.0-preview3.19128.7 26 09/22/2022
2.1.0-preview.19073.11 4 09/21/2022
2.1.0-preview.18571.3 18 09/21/2022
2.0.1 11 09/21/2022
2.0.0 5 09/11/2023
2.0.0-rc1 50 09/22/2022
2.0.0-preview2-26406-04 4 09/23/2022
2.0.0-preview1-26216-02 10 09/21/2022
2.0.0-preview1-25914-04 36 09/23/2022