The easiest way:
Starting with .Net Core 3 the easiest way to do it is to backup your Program.cs
somewhere on a disk (or just using git) and run the following command where Program.cs
is located:
dotnet new winforms --force
It will replace your Program.cs
and .csproj
. Then just copy required code from your old Program.cs
. That's it!
For manually converting the project this may be helpful:
Here is how .Net Core 3 project looks like (generated using dotnet new winforms
):
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
</Project>
Here is how Program.cs
looks for a new project:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LinkInterceptor
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}