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'

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,385 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,262 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,120 questions
{count} votes

1 answer

Sort by: Oldest
  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