SharePoint 2010 Visual Web Parts Missing .ascx.g.cs In Visual Studio 2012 - by Derek Miller (Uber)

Status : 

  Not Reproducible<br /><br />
		The product team could not reproduce this item with the description and steps provided.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 766021 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 10/3/2012 8:02:27 PM
Access Restriction Public


It appears that the old issue in VS2010 where the .ascx.g.cs file does not generate after a certain number of characters in the .ascx file is reached, is back in VS2012.

Create a visual web part project (appears to be an issue in both sandboxed and farm projects). Start adding controls to the user control.
After a certain point, the designer stops generating the .ascx.g.cs file and the project will not build as the code cannot see the InitialiseControl method or any of the controls definewd in the user control.

So now it is NOT POSSIBLE at all to implement a Visual Web part for SP2010 in Visual Studio 2012.

Sign in to post a comment.
Posted by Labhesh Shrimali on 8/10/2013 at 3:10 AM

Install Visual studio 2012.
create sharepoint project and under that create webpart,
the bug is reproduced.
Cheers !
Posted by Zerg00s on 8/9/2013 at 2:33 PM
One of my colleagues had the same problem yesterday. I thought it was just a random bug. However, When I came home and tried to create a fresh Visual Web part as a test, it turned out that ascx.g.cs file is not generated at all. I have installed 11.0.60610.01 Update 3 in Visual Studio 2012. I have disabled all Extensions, just in case. And yes, I would not really close this bug... I have no idea how to create a Visual Web part now.
Posted by MaartenSundman on 3/6/2013 at 2:23 PM
This issue has returned again in the RTW of the Office 2013 Visual Studio 2012 Dev Tools released 2/26. This had been resolved in the preview bits.
Posted by Labhesh Shrimali on 3/5/2013 at 7:32 AM
Hi, when I am making my visual webpart multilanguage that is : when adding $Resource:filename,key in the .ascx file, the webpart starts complaining.

The issue still available. let me know if someone has this sorted out.
Posted by Ben Stegink on 1/10/2013 at 11:06 PM
I experience this same bug, however in my case it isn't due to a certain number of characters, but adding <%@ Register %> or <% Assembly %> to my .ascx file immediately clears the .ascx.g.cs file. I have been able to consistently replicate this on two different SharePoint servers.
Posted by Chakkaradeep [MSFT] on 1/8/2013 at 6:41 PM
Hi Derek,

We are unable to reproduce the issue. We ran several tests in our latest builds and failed to reproduce the error.

Please install the latest updates to Visual Studio and Office Developer Tools.

Chakkaradeep Chandran, Program Manager, Visual Studio SharePoint Tools
Posted by D0d1us on 11/11/2012 at 9:14 AM

did you managed to solve it?
for some reason ascx.g.cs - is not generated and I'm constantly receiveing:

The name 'InitializeControl' does not exist in the current context

have try from scrach... few time it works on absolutey clean project, but then fails again.
Ver. 11.0.50727.1 RTMREL
Posted by Chakkaradeep [MSFT] on 10/29/2012 at 2:15 PM
Hi Derek,

Thank you for your feedback. We were not able to reproduce this issue in our latest builds. Please verify this bug again with our next release and reactivate this bug if necessary.

Chakkaradeep Chandran,
Program Manager, Visual Studio SharePoint Developer Tools
Posted by Macy [MSFT] on 10/3/2012 at 8:52 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(