2
votes

I've inherited a SharePoint 2010 project that was originally created in another environment using a different version of Visual Studio (2012). My issue is that the .g.cs files for some WebParts are not being [re-]generated when I make changes to the .ascx files. I know that for regular .aspx pages, you can right-click and choose "Convert to Web Application" to force generation of the designer files. Is there something similar for WebParts?

I've already tried deleting the bin\ and obj\ directories in the project, cleaning and rebuilding (both the solution and the project), as well as trying to re-create the WebPart from scratch.

3

3 Answers

1
votes

Wrote about workaround here: http://sadomovalex.blogspot.com/2013/08/fix-bug-in-visual-studio-2012-with.html. You need to specify url of correct Sharepoint site on local dev environment in "Site URL" property of your project.

0
votes

It seems that it's an issue from going between Visual Studio 2010 and 2012. On the 2012 box the .g.cs files are regenerated and updated fine but the 2010 box refuses to do so.

Correction: SharePointWebPartCodeGenerator wasn't being found. After re-installing the Visual Studio 2010 SharePoint Power Tools, the .g.cs files were being updated.

0
votes

I searched forever for a fix and installing the 2010 SharePoint Power Tools solution fixed the issue! The solution I was working on must have been a 2012 Sandbox solution.