visual studio windows form call error

shams 21 Reputation points
2021-04-26T10:43:01.043+00:00

when i try to add windows form to my project , it outputs errors
i make clr empty project .net framework

Instances of this error (1)

  1. Hide Call Stack

at Microsoft.VisualStudio.Designer.Interfaces.IVSMDCodeDomProvider.get_CodeDomProvider()
at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_Provider()
at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_CompileUnit()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,856 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,561 questions
{count} votes

Accepted answer
  1. Daniel Zhang-MSFT 9,621 Reputation points
    2021-04-27T01:50:00.94+00:00

    Hi shams-4721,
    Please follow the steps below:
    1.Close the error page and add the following code to the MyForm.cpp:(my project name is Project8)

    using namespace System;  
    using namespace System::Windows::Forms;  
    [STAThreadAttribute]  
    void Main(array<String^>^ args) {  
            Application::EnableVisualStyles();  
            Application::SetCompatibleTextRenderingDefault(false);  
            Project8(your project name)::MyForm form;  
            Application::Run(%form);  
    }  
    

    2.Right click on the your project name and choose Properties option.
    3.Then
    91544-4271.png
    91561-4272.png
    4.Reopen your project.
    There is a more detailed step in this thread you can refer to.
    Best Regards,
    Daniel Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Viorel 112.9K Reputation points
    2021-04-26T17:50:11.73+00:00

    Try closing the tabs that are related to your new form, build the solution and re-open the form from Solution window.

    0 comments No comments