Monday, August 12, 2013

SP2013 & VS2012: .ascx.g.cs missing!

I've been working with SharePoint 2013 for a while now, on and off...well, mostly off to be honest, as the main client I'm working for - 80% of my time - is still on SP2010 (will be very interesting to get them moved to SP2013!).

The first annoying issue I got was with missing .ascx.g.cs files for the Web Parts. I couldn't actually understand what the hell was happening, for a while! We're using a farm solution (we have full control on the environments) and Visual Studio 2012 to develop.

Well, it seems Visual Studio, when saving a Web Part, always recreates the .ascx.g.cs file. No problem there, the issue really comes if you are on offline mode or are not able to connect to the SharePoint site with full privileges. Why? Visual Studio, for some reason, needs to connect to the SharePoint site, otherwise it does not recreate the .ascx.g.cs file, only deletes it, creating a build error.

My issue was I didn't have full rights on the DB, as I had recently changed account and hadn't configured those yet, but it can happen whenever you have any connection break with the SharePoint site or if you haven't set up the SharePoint site's URL. A bit annoying!

So...make sure you're connected to the SharePoint site when saving a Web Part!

Going back to SP2013...We haven't really started posting about it, but like I said we're already working on it for a while! Besides the obvious reading and trying out the new stuff in some test VMs, I know João has been working on a large implementation for a multinational corporation in Ireland - maybe he can give us an insight into that later - if the damn NDAs allow :)

I have already implemented a Communications portal for Microsoft Ireland, released in very early days of SP2013, and I'm actively managing and working on our company's own Internet portal, to be released soon!

Both sites represent typical WCM scenarios and it's been very interesting to learn and use some of the new features. More on this to come soon, once I have a little bit more time to write, I believe September will be a good month for a nice rentrée.


  1. the problem can also be sitanxis in some html tag

  2. This comment has been removed by the author.

  3. Thank you from 2020. Yes the sp2013 with vs2012 systems are still arround *crying smiley*