I have many VB applications written in Visual Basic, from 2006 to 1019, using .NET 4.8 framework. I want to upgrade to .NET 10.0 in Studio 2026.
The compiler signals differences between .Net framework and .NET core, which / can resolve. But: some applications have a Module with a Sub Main(...) which manages the Forms to use.
I open Visual Studio Community 2026, click new project, choose Windows Forms App from Visual Basic Windows Desktop. I give the project a name (TestApp). I leave Additional information as it is and click Create. In the project I add a module and insert a public sub main in the module. This sub is shown as 0 references.
I save and reopen the project, one never knows. The project contains a form Form1(.vb, .resx, .designer.vb), a module Module1.vb and a namespace My ApplicationEvents.vb with a partial class MyApplication.
In the project properties, Application part, I have Enable Windows Forms checked and in Startup object I see only TestApp.Form1. The References have System Windows Forms checked.
This does not compile. The error is BC30738: sub main is declared more than once in TestApp.My.MyApplication.Main and in TestApp.Module1.Main.
When I rename the Module1.main the project compiles and shows Form1.
When I rename Sub Main in the XML TestApp to Sub xMain, it does not compile with error BC30420 Sub Main was not found in Sub xMain
When I uncheck Enable Windows Forms (which takes some seconds to finish) it does not compile with error BC30002, because the references are completely new and don't include System.Windows.Forms anymore. After a minute or so a message appears, something like: Timeout for a named Pipe.
WHAT do I have to do here to have my Main as startup object. In .Net Framework properties showed a choice between Form1 and Main. Here it lacks.