Search

Visual Web Part in VS2012, code in ascx.g.cs is erased by Ben Stegink

Closed
as By Design Help for as By Design

4
0
Sign in
to vote
Type: Bug
ID: 776340
Opened: 1/11/2013 8:20:27 AM
Access Restriction: Public
0
Workaround(s)
3
User(s) can reproduce this bug
Creating a new SharePoint 2010 Visual Web Part in Visual Studio 2012. Add <%@ Register %> to the .ascx file and all the code is erased deleted from the .ascx.g.cs file.
Details (expand)

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

Visual Studio 2012

Steps to reproduce

Creating a new SharePoint 2010 Visual Web Part in Visual Studio 2012. Add <%@ Register %> to the .ascx file and all the code is erased deleted from the .ascx.g.cs file. Blog post here with details and screen shots - http://www.sharepointben.com/blog/Lists/Posts/Post.aspx?ID=646

Product Language

English

Operating System

Windows Server 2008 R2 SP1

Operating System Language

English

Actual results

.acxs.g.cs has all the code erased thus breaking the visual web part

Expected results

.ascx.g.cs should stay in tact so a visual web part can be built and compiled.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Vasyl Viyatyk on 5/15/2013 at 8:00 AM
Hi Guys
I have had the same issue.
in one case there were two equal attributes in the tag.
in other case attribute <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %> was without space in the end of line. (<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$"%>)
Posted by matifimran on 4/8/2013 at 3:57 AM
I am facing the same issue while using Telerik controls in webparts. Any fix available for this issue?
Posted by W0uter on 2/18/2013 at 4:25 AM
I have the same issue.

When saving a visual webpart ascx file the ascx.g.cs file is deleted from the hard drive. The references to the file in the project file are also deleted. Nu actual change to the ascx is needed. I do ctrl+s in the ascx and the acsx.g.cs files is gone.


Visual Studio 2012. SharePoint 2013 project. Disabled 3th party plugins.
Posted by Microsoft on 1/17/2013 at 11:19 AM
Hi,

Thanks for the feedback. Can you complete the <%@Register %> tag with all the required attributes and then check whether the VisualWebPart.ascx.g.cs file? Visual Studio communicates with SharePoint to generate the VisualWebPart.ascx.g.cs and will not be generated if there are any errors or if SharePoint is not able to resolve something in the VisualWebPart file.

Thanks,
Chakkaradeep Chandran, Program Manager, Office Developer Tools
Posted by Microsoft on 1/13/2013 at 11:17 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 1/11/2013 at 8:51 AM
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.