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

后端 未结 4 1052
感动是毒
感动是毒 2020-12-19 10:15

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

相关标签:
4条回答
  • 2020-12-19 10:53

    .Net core 3 preview is released which includes WPF and Win Forms support. You can use it with Visual studio 2019 preview which can publish Win Forms platform independently and self contained.

    0 讨论(0)
  • 2020-12-19 11:04

    I know this is an old post, but I am currently in the process of doing this I can tell you it is very possible now. Hopefully when I'm done it catches on, basically I'm creating a simple user interface to pass off to a D&D DM so he can administer the game easily.

    Like I said I know this is an old post and probably no one cares, but I figured I'd throw it out there that it can be done.

    0 讨论(0)
  • 2020-12-19 11:07

    Edit: Since I wrote this back in September 2017, the reality has changed. As of the .NET Core SDK 3, Windows Forms support has been added back in. It does not have the platform independance of many other parts of .NET Core and converting between .NET Framework and .NET Core WinForms code needs a conversion tool. But it is there.

    No, not really. .NET Core is a specific selection of classes from the larger .NET Framework, which includes Windows Forms. Windows Forms is one of the things they (had to) cut out to make the smaller .NET Core.

    Last I looked, .NET Core had support for UWP (a followup to WPF), Xamarin and ASP.Net 5 (Core version). UWP and maybe Xamarin would be suitable for Desktop applications:

    • Frameworks, Programming for .NET, Display technologies and the like
    0 讨论(0)
  • 2020-12-19 11:07

    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

    • Updates to .NET Core Windows Forms designer in Visual Studio 16.5 Preview 1
    • Announcing .NET Core 3 Preview 1 and Open Sourcing Windows Desktop Framework
    • .NET Core Windows Form GitHub Repository
    • WinForms on .NET Core Roadmap
    • .NET Core Windows Forms Samples
    • Porting existing applications to .NET Core 3.0
    0 讨论(0)
提交回复
热议问题