Errors in Windows Forms controls in designer view

后端 未结 3 1286
后悔当初
后悔当初 2020-12-11 14:51

On occasion, I get the following error in design mode of some user controls in Visual Studio 2008:

The file \'UserControl.vb\' does not support code

相关标签:
3条回答
  • 2020-12-11 15:26

    It is a bug in VS. It happens in VS2005 as well.

    Don't waste your time: close VS, open it again and everything should work fine.

    0 讨论(0)
  • 2020-12-11 15:26

    Note that there is a Microsoft Connect issue on this: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=366006

    0 讨论(0)
  • 2020-12-11 15:44

    I had reverted (through source control) changes to my project file, which removed the file from my solution (specifically the .Designer file). However, I still had the file open in Visual Studio and attempting to show the designer for it caused this error.

    I clicked the "Show All Files" button at the top of Solution Explorer, found the files that weren't included. Right-clicking and selecting "Include in Project" and rebuilding fixed the issue for me.

    0 讨论(0)
提交回复
热议问题