How to use treeview and treenode classes in .Net core console application

Prabs 1 Reputation point
2021-04-16T11:11:45.597+00:00

Hi,
I have an .Net core console application for linux platform.
How to create treeview in .Net Core console application dynamically.
I need this for one of my requirement.
I know treeview and treenode used to show in GUI, But in my console project these two classes needed

I used below lines for adding windows forms,
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
. . .
<UseWindowsForms>true</UseWindowsForms>
<DisableWinExeOutputInference>true</DisableWinExeOutputInference>
</PropertyGroup>
</Project>

When i do publish, it is giving below error

Error:

There was no runtime pack for Microsoft.WindowsDesktop.App.WindowsForms available for the specified RuntimeIdentifier 'linux-x64'

Developer technologies .NET .NET Runtime
Developer technologies .NET Other
Developer technologies C#
{count} votes

1 answer

Sort by: Most helpful
  1. Adam Jachocki 46 Reputation points
    2021-09-09T09:54:50.63+00:00

    Simply - you can't. GUI controls are strictly bound to Windows operating system. So you just can't use these dlls as they use Windows specific apis.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.