Search

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

Closed
as Not Reproducible Help for as Not Reproducible

5
0
Sign in
to vote
Type: Bug
ID: 766021
Opened: 10/3/2012 8:02:27 PM
Access Restriction: Public
1
Workaround(s)
0
User(s) can reproduce this bug
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.

Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

Visual Studio 2012

What category (if any) best represents this feedback?

 

Steps to reproduce

Try to create a visual web part with more than 8190 characters in the user control markup.
Bang, no longer compiles.

Product Language

English

Operating System

Windows Server 2008 R2 SP1

Operating System Language

English

Actual results

Project will not compile, EVER!

Expected results

Project compiles and visual web part can be deployed and tested.

Locale

 
File Attachments
File Name Submitted By Submitted On File Size  
SharePoint14VisualWebPart.zip 3/5/2013 4 KB
Sign in to post a comment.
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 Microsoft 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.

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

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.
VS2012
Ver. 11.0.50727.1 RTMREL
Posted by Microsoft 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.

Thanks,
Chakkaradeep Chandran,
Program Manager, Visual Studio SharePoint Developer Tools
Posted by Microsoft 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(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Labhesh Shrimali on 3/5/2013 at 11:39 PM
Today I encountered a weird issue, the classic Visual Web Part template was gone in Visual Studio 2012. When I created a Visual WebPart, a webpart was created with a generated .g.cs file, like the sandboxed visual webparts. I am not exactly sure why it happened. According to the MSDN guide Creating Web Parts for SharePoint, the structure of Visual Webparts should be the same as in Visual Studio 2010. It could have happened after I installed the power tools.

However, if someone runs into the same issue, here is the solution:

Copy this zip file from a computer with VS2010 installed:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\SharePoint\SharePoint14\1033\SharePoint14VisualWebPart.zip
Unpack it.

Edit SharePointVisualWebPart.vstemplate. Change the assembly line so it references to the Version 11:

After that copy the directory SharePoint14VisualWebPart to these two locations on your computer with Visual Studio 2012 installed.

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplatesCache\CSharp\SharePoint\SharePoint14\1033\
Just to be safe, save the SharePoint14VisualWebPart (which have the same name) by appending “.bak” to the name.

Tx to the post: http://chuvash.eu/2012/09/20/the-original-visual-web-part-template-is-missing-in-visual-studio-2012/