Windows Compatibility Pack for .NET Core

Sign in to queue

Description

The Windows Compatibility Pack is a NuGet package that adds Windows-specific APIs to .NET Core. See how this enables applications that target the .NET Framework to easily migrate to the faster .NET Core runtime.


Product info: www.dot.net
Learn more: aka.ms/wincompatpack
Documentation: aka.ms/wincompatpack

For more information, check out this course on Microsoft Virtual Academy:

Tags:

.NET, .NET Core

Day:

0

Session Type:

On-demand

Code:

T123

Embed

Download

Download this episode

Download captions

For more information, check out this course on Microsoft Virtual Academy:

The Discussion

  • User profile image
    Jason

    Thank you for the video. Please describe how this might fit into future plans for PowerShell Core, if any. Were you in touch with the PowerShell Core team as you developed this? There might be no connection or intended interaction, just wondering. Thanks!

  • User profile image
    terrajobst

    @Jason:Yes, we've been working closely with the PowerShell team on .NET Core. Do you have specific concerns or questions?

  • User profile image
    ErikEJ

    Can you use this package with a .NET Standard library? In other words, does this enable porting a .NET FW 4.5 library to .NET Standard easier?

  • User profile image
    Jason

    @TerraJobst Great! A big concern about PoShCore is compatibility with scripts, DSC resource modules, and DSC configurations written for Windows PoSh 5.1, but this Compatibility Pack might be very important for reducing these fears. Can you share any testing or plans in this regard? Thanks!

  • User profile image
    Eric

    Why did't Microsoft just include this as part of .Net core?

    Why hasn't Microsoft started build some kind of cross platform abstraction api for common tasks?

  • User profile image
    terrajobst

    Can you use this package with a .NET Standard library? In other words, does this enable porting a .NET FW 4.5 library to .NET Standard easier?



    Yes, the package installs into .NET Standard projects as well. See the spec for scenarios.

  • User profile image
    terrajobst

    @TerraJobst Great! A big concern about PoShCore is compatibility with scripts, DSC resource modules, and DSC configurations written for Windows PoSh 5.1, but this Compatibility Pack might be very important for reducing these fears. Can you share any testing or plans in this regard? Thanks!



    The PowerShell team would be better suited to answer these questions. I suggest you ask here.

  • User profile image
    terrajobst

    Why did't Microsoft just include this as part of .Net core?



    I've explained this in the documentation:

    This package is a logical extension of .NET Standard 2.0 that significantly increases API set and existing code compiles with almost no modifications. But in order to keep the promise of .NET Standard ("it is the set of APIs that all .NET implementations provide"), this didn't include technologies that can't work across all platforms, such as registry, Windows Management Instrumentation (WMI), or reflection emit APIs.

    The Windows Compatibility Pack sits on top of .NET Standard and provides access to technologies that are Windows only. It's especially useful for customers that want to move to .NET Core but plan to stay on Windows as a first step. In that scenario, not being able to use Windows-only technologies is only a migration hurdle with zero architectural benefits.

    Regarding this question:

    Why hasn't Microsoft started build some kind of cross platform abstraction api for common tasks?



    You mean like a set of APIs that cover basic tasks like reading files, accessing the network, or parsing documents? Yeah, that's what .NET Standard is (a)

    Seriously, what APIs would like to see being abstracted?

  • User profile image
    Eric


    What would I like to see in a abstraction API?

    Drawing, Rendering
    Cross Platform UI
    Sound
    Video playback

    There's so many things that core still can't do, but every OS can

  • User profile image
    aueda

    Hey @terrajobst, nice job! This package is an impressive step towards keeping legacy code running!

    I have a question though: is there any plans to add compatibility to the Webforms API, e.g., the System.Web.UI namespace, even if on Windows-only?

    Thank you!

  • User profile image
    Niner661687

    great! Thanks for adding this!

  • User profile image
    Tim Trahan

    Using system.drawing in a linux docker.

    I am trying to work with the drawing library in the windows compatibility pack but I don't think the linux docker that's getting pulled has all the libraries I need installed. I can get everything to run but when it hits the code working with images it throws an error:

    System.TypeInitializationException: 'The type initializer for 'Gdip' threw an exception.'


    FROM microsoft/aspnetcore:2.0
    ARG source
    WORKDIR /app
    EXPOSE 80
    COPY ${source:-obj/Docker/publish} .
    ENTRYPOINT ["dotnet", "DotNetCoreTest.dll"]

Add Your 2 Cents