Changing Startup Form in VS 2022 Breaks Project.

Phill 61 Reputation points
2022-05-22T16:00:40.907+00:00

When I attempt to change the startup form in a VB.NET project, I receive the following error.

204394-capture.jpg

After the error pops up, the forms no longer appear in the list and the project will not run.

204356-capture2.jpg

I am running Microsoft Visual Studio Professional 2022 (64-bit) - Current
Version 17.2.0

If I open the same project in Visual Studio 2013, I am able to see the Form in the startup objects and select it without any error. I also use the same install of Visual Studio 2022 to work with existing projects but haven't tried to change the startup form because I do not wish to break the project.

Is this a bug in Visual Studio?

Thanks

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,140 questions
{count} votes

Accepted answer
  1. Viorel 117.6K Reputation points
    2022-05-22T20:41:46.923+00:00

3 additional answers

Sort by: Most helpful
  1. iLens 6 Reputation points
    2022-07-19T09:54:56.25+00:00

    Close the project, then

    1. Edit ..\MyProject\Application.myApp to show
      <?xml version="1.0" encoding="utf-8"?>
      <MyApplicationData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <MySubMain>true</MySubMain>
      <MainForm>MySartupForm</MainForm>
      <SingleInstance>true</SingleInstance>
      <ShutdownMode>0</ShutdownMode>
      <EnableVisualStyles>true</EnableVisualStyles>
      <AuthenticationMode>0</AuthenticationMode>
      <SaveMySettingsOnExit>true</SaveMySettingsOnExit>
      </MyApplicationData>
      replacing "MySartupForm" with your form name

    2.Edit ..xxx.vbproject to change
    <MyType>WindowsFormsWithCustomSubMain</MyType> to <MyType>WindowsForms</MyType>

    1 person found this answer helpful.

  2. Alan Williams 1 Reputation point
    2022-07-27T09:19:47.593+00:00

    Hi, I made a complaint to Visual Studio as no upgrade should have such a major impact on functionality and productivity. It was I believe an earlier upgrade which caused the problem as I had no trouble when first using it. I received a response with a link which enabled me to download a preview version of the next major update. This version works fine. You may want to report it as a new issue to obtain the link.

    0 comments No comments

  3. winter snow 1 Reputation point
    2022-08-12T10:04:15.717+00:00

    It's hard to believe that Microsoft has made such a big bug on VS

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.