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)

Developer technologies | Windows Forms
Developer technologies | C++
Developer technologies | 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.
{count} votes

Answer accepted by question author
  1. Daniel Zhang-MSFT 9,661 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 125.7K 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.

    1 person found this answer helpful.

Your answer

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