Lurker Indeed
Lurker Indeed

Reputation: 1531

Errors in Windows Forms controls in designer view

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 parsing or generation because it is not contained within a project that supports code.

It doesn't happen on a consistent basis, but it happens enough to be annoying. Are there any common causes of this error?

And yes, it is in a project that supports code - last I checked, WinForms projects typically have code in them!

Upvotes: 32

Views: 8685

Answers (3)

Jeff B
Jeff B

Reputation: 8972

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.

Upvotes: 0

JoshL
JoshL

Reputation: 10988

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

Upvotes: 5

andrecarlucci
andrecarlucci

Reputation: 6296

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.

Upvotes: 33

Related Questions