Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
177 views
in Technique[技术] by (71.8m points)

c# - .NET Core - Is there a way to implement WinForms?

I'm currently making a bot for a discord server with Discord.NET and I'd like to create a WinForm for this instead of a console. Is there a way to implement WinForms to a .NET Core app?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Starting from .NET Core 3.0, you can create Windows Forms applications using .NET Core.

VS 2019

The project template is available in VS 2019.

VS 2017

You need to have Visual Studio 2017 Update 15.8 or higher.

  1. Install Visual Studio 2017 Update 15.8 or higher
    [Visual Studio download site.]
  2. Install the latest .NET Core 3.0 SDK
    [daily build (latest changes, but less stable) or preview (more stable, recommended)].

  3. Open command prompt and run the following command to create the project:

    dotnet new winforms -o MyWinFormsApp
    
  4. To build and run the project, you can go to the directory in which the project is created and open MyWinFormsApp.csproj using Visual Studio, build and run it.

    You can also run the following commands if you prefer to build and run from command line:

    cd MyWinFormsApp
    dotnet build
    dotnet run
    

Note

  • Project Template: The project template is available in VS 2019.
  • Designer: Along with GA release of .NET Core 3.0, Windows Forms Designer Preview 1 has also been released and can be used in VS 2019. Also starting from Visual Studio 16.5 Preview 1 and by release of .NET CORE 3.1, Visual Studio has built in support for designer. Take a look at this post. But keep in mind, in this release, many controls aren’t yet supported in designer.

Related links


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...