Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package type DotnetPlatform that is incompatible with this project

I use UIAutomationClient.dll in a Framework project which I'm moving to Core. This will only be on Windows so it's OK. But I need to reference it in way that can be run on differenet windows machines. There is a nuget package for this, commented that it should not be referenced directly. So how do I get it? If I go ahead and choose it, I get the error:

package type DotnetPlatform that is incompatible with this project

Please note: this is a console application which does some UI automating. It's not a desktop app, not WPF.

enter image description here

like image 881
Daniel Williams Avatar asked Jan 02 '20 19:01

Daniel Williams


1 Answers

As vatsan-madhavan wrote on GitHub, you can use:

<ItemGroup>
  <FrameworkReference Include="Microsoft.WindowsDesktop.App.Wpf" />
</ItemGroup>

Learning from all the problems with the BCL packages in .NET Core 1.x and 2.x, starting from .NET Core 3.0, the .NET Core SDK and NuGet support FrameworkReference, which does not use version numbers (the SDK tells NuGet which version to download). Since it's so new, it's not well known, or frequently documented.

like image 89
zivkan Avatar answered Sep 23 '22 09:09

zivkan