I wanted a custom Sub Main for a VB WinForms app. I’ve created the VB.Net app (.NET Framework 4.8) with VS2022. Unchecked the “Enable application framework” option of the project. Created the following module:
Module Startup
Private _mainForm As MainForm = New MainForm()
Sub Main()
_mainForm.ShowDialog()
End Sub
End Module
This worked fine when debugging with VS2022 but when I loaded the project with the AlterNET Studio Demo app, the following error was given during compilation:
Error Code: BC30738
Description: ‘Sub Main’ is declared more than once in ‘VBTest’: VBTest.My.MyApplication.Main(Args As String()), VBTest.Startup.Main()
Did I do something wrong or Scripter does not support custom Sub Main?
Hello,
Thank you for reporting this issue. For a workaround, please add the following line in the AlternetStudio sample source code, file MainForm.Project.cs, at the end of the void OpenProject(string fileName) method: