Microsoft.Windows.Compatibility 9.0.0-rc.1.24452.1

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
Topshelf
Topshelf is an open source project for hosting services without friction. By referencing Topshelf, your console application *becomes* a service installer with a comprehensive set of command-line options for installing, configuring, and running your application as a service.
1
TopShelf.ServiceInstaller
Topshelf is an open source project for hosting services without friction. By referencing Topshelf, your console application *becomes* a service installer with a comprehensive set of command-line options for installing, configuring, and running your application as a service.
1

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-rc.1.24452.1 1 22.09.2024
9.0.0-preview.7.24405.2 0 13.08.2024
9.0.0-preview.6.24327.6 0 09.07.2024
9.0.0-preview.5.24306.8 0 11.06.2024
9.0.0-preview.4.24267.11 0 21.05.2024
9.0.0-preview.3.24175.3 0 11.04.2024
9.0.0-preview.2.24128.10 0 12.03.2024
9.0.0-preview.1.24081.3 0 13.02.2024
8.0.8 0 13.08.2024
8.0.7 0 09.07.2024
8.0.6 0 28.05.2024
8.0.5 0 14.05.2024
8.0.4 0 09.04.2024
8.0.3 0 12.03.2024
8.0.2 0 13.02.2024
8.0.1 0 09.01.2024
8.0.0 0 14.11.2023
8.0.0-rc.2.23479.10 0 10.10.2023
8.0.0-rc.1.23420.5 0 12.09.2023
8.0.0-preview.7.23376.1 0 08.08.2023
8.0.0-preview.6.23329.4 0 11.07.2023
8.0.0-preview.5.23302.2 0 13.06.2023
8.0.0-preview.4.23260.1 0 16.05.2023
8.0.0-preview.3.23174.8 0 11.04.2023
8.0.0-preview.2.23128.3 0 14.03.2023
8.0.0-preview.1.23110.8 0 21.02.2023
7.0.6 0 12.03.2024
7.0.5 0 12.09.2023
7.0.4 0 22.06.2023
7.0.3 0 13.06.2023
7.0.1 0 11.04.2023
7.0.0 0 07.11.2022
7.0.0-rc.2.22472.3 0 11.10.2022
7.0.0-rc.1.22426.10 0 14.09.2022
7.0.0-preview.7.22375.6 0 09.08.2022
7.0.0-preview.6.22324.4 0 12.07.2022
7.0.0-preview.5.22301.12 0 14.06.2022
7.0.0-preview.4.22229.4 0 10.05.2022
7.0.0-preview.3.22175.4 0 13.04.2022
7.0.0-preview.2.22152.2 0 14.03.2022
7.0.0-preview.1.22076.8 0 17.02.2022
6.0.8 0 12.03.2024
6.0.7 0 22.06.2023
6.0.6 0 13.06.2023
6.0.4 0 11.04.2023
6.0.3 0 14.02.2023
6.0.2 0 13.12.2022
6.0.1 0 27.10.2022
6.0.0 0 08.11.2021
6.0.0-rc.2.21480.5 0 12.10.2021
6.0.0-rc.1.21451.13 0 14.09.2021
6.0.0-preview.7.21377.19 0 10.08.2021
6.0.0-preview.6.21352.13 0 21.07.2021
6.0.0-preview.5.21301.5 0 15.06.2021
6.0.0-preview.4.21253.7 0 24.05.2021
6.0.0-preview.3.21201.4 0 08.04.2021
6.0.0-preview.2.21154.6 0 11.03.2021
6.0.0-preview.1.21102.12 0 12.02.2021
5.0.2 0 09.02.2021
5.0.1 0 12.01.2021
5.0.0 0 09.11.2020
5.0.0-rc.2.20475.5 0 13.10.2020
5.0.0-rc.1.20451.14 0 14.09.2020
5.0.0-preview.8.20407.11 0 25.08.2020
5.0.0-preview.7.20364.11 0 21.07.2020
5.0.0-preview.6.20305.6 0 25.06.2020
5.0.0-preview.5.20278.1 0 10.06.2020
5.0.0-preview.4.20251.6 0 18.05.2020
5.0.0-preview.3.20214.6 0 23.04.2020
5.0.0-preview.2.20160.6 0 02.04.2020
5.0.0-preview.1.20120.5 0 16.03.2020
3.1.5 0 09.01.2024
3.1.4 0 13.12.2022
3.1.2 0 14.09.2021
3.1.1 0 11.08.2020
3.1.0 0 03.12.2019
3.1.0-preview3.19551.4 0 13.11.2019
3.1.0-preview2.19523.17 0 01.11.2019
3.1.0-preview1.19504.10 0 15.10.2019
3.0.1 0 18.11.2019
3.0.0 0 23.09.2019
3.0.0-rc1.19456.4 0 16.09.2019
3.0.0-preview9.19421.4 0 04.09.2019
3.0.0-preview9.19416.11 0 04.09.2019
3.0.0-preview8.19405.3 0 13.08.2019
3.0.0-preview7.19362.9 0 23.07.2019
3.0.0-preview6.19303.8 0 12.06.2019
3.0.0-preview6.19264.9 0 04.09.2019
3.0.0-preview5.19224.8 0 06.05.2019
3.0.0-preview4.19212.13 0 18.04.2019
2.1.1 0 14.05.2019
2.1.0-preview3.19128.7 0 06.03.2019
2.1.0-preview.19073.11 0 29.01.2019
2.1.0-preview.18571.3 0 03.12.2018
2.0.1 0 21.08.2018
2.0.0 0 29.05.2018
2.0.0-rc1 0 06.05.2018
2.0.0-preview2-26406-04 0 10.04.2018
2.0.0-preview1-26216-02 0 26.02.2018
2.0.0-preview1-25914-04 0 15.11.2017