When attempting to add Microsoft.Windows.Desktop.App 8.0.6 I am getting "Package ... has packagetype 'DotnetPlatform' that is not supported

Ron Oakes 0 Reputation points
2024-06-12T19:59:06.6766667+00:00

As part of moving from the deprecated WMPLib.WindowsMediaPlayer class to the current Windows.Media.Playback.MediaPlayer class, I am attempting to properly include the required DLL and all dependencies. The MediaPlayer class is a Windows Desktop 8 class according to the online documentation (https://video2.skills-academy.com/en-us/dotnet/api/system.windows.media.mediaplayer?view=windowsdesktop-8.0), so I attempted to install the NuGet package Microsoft.Windows.Desktop.App.Ref version 8.0.6. But when I do so I get the following errors:

  • Package 'Microsoft.WindowsDesktop.App.Ref 8.0.6' has a package type 'DotnetPlatform' that is not supported by project 'ConlangAudioHoning'.
  • NU1213 The package Microsoft.WindowsDesktop.App.Ref 8.0.6 has a package type DotnetPlatform that is incompatible with this project. ConlangAudioHoning

My project is currently a .NET 8.0 project targeting Windows with the Target OS set to "8.0" and the Supported OS versions set to "8.0"

My searches for similar answers has not turned up any related to Windows Desktop App.

The AI suggestion of installing "Microsoft.Windows.Desktop.App" turned up no valid results (and what I did install has caused enough disruption that I'm going to do a full reimage from GitHub to be sure I've reverted it).

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,565 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2024-06-12T19:59:06.68+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error message you are receiving indicates that the NuGet package you are trying to install, Microsoft.WindowsDesktop.App.Ref version 8.0.6, has a package type 'DotnetPlatform' that is not compatible with your project. This package is a reference package that provides metadata for the Microsoft.WindowsDesktop.App NuGet package, which contains the Windows Desktop 8 runtime components.

    To use the Windows Desktop 8 runtime components, you need to install the Microsoft.WindowsDesktop.App NuGet package instead of the Microsoft.WindowsDesktop.App.Ref package. You can install the Microsoft.WindowsDesktop.App NuGet package by searching for it in the NuGet Package Manager in Visual Studio and installing the appropriate version for your project.


    References:

    0 comments No comments

  2. Jiale Xue - MSFT 42,061 Reputation points Microsoft Vendor
    2024-06-28T08:28:47.32+00:00

    Hi @Ron Oakes , Welcome to Microsoft Q&A,

    First you need to make sure you are creating a Winforms project or a WPF project.

    Make sure your project file (.csproj) target framework is correctly set to net8.0-windows.

    <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
    <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0-windows</TargetFramework>
    <UseWPF>true</UseWPF> <!-- or <UseWindowsForms>true</UseWindowsForms> -->
    </PropertyGroup>
    </Project>
    

    You don't need to manually add the Microsoft.WindowsDesktop.App.Ref package because it is automatically included when you set the target framework to net8.0-windows. If this package has already been added, try removing it and restoring the NuGet package.

    Best Regards,

    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments