Wednesday, November 13, 2013

Missing items from virtual directories when upgrading solutions to SP2013

Recently I was working on a SharePoint migration from SP2010 to SP2013. The migration involved several custom solutions that contained various items ranging from custom web parts to web services.

The process for upgrading those solutions was pretty straightforward except for one problem that involved my custom field types. After successfully rebuilding my solution to work on SP2013 and deploying them to my test environment, when I tried to add them to my test list I was greeted with an "Cannot find ..." error for my FieldEditor control. After assuring that there was nothing wrong with my code, I inspected the field definition XML file.
In it I found that the missing field editor control is referenced like this:
<Field Name="FieldEditorUserControl">~/_CONTROLTEMPLATES/DatabaseLookup/CustomFieldEditor.ascx</Field>

And there is the problem, in SharePoint 2013 there is a small change in a way you are accessing your virtual directories (folders in 15 hive like _layouts and _controltemplates) described in this article:

"...This new system has implications for you as you develop SharePoint 2013 solutions and apps, particularly when you are using the SharePoint 2010 SDK. In any app for SharePoint (which only run in SharePoint 2013 mode) and in any SharePoint solution that you know is only going to be used in site collections that run in SharePoint 2013 mode, you need to add the "/15" yourself to all the _layouts and _controltemplates virtual paths you create in your solution/app..."

After changing my xml file to get my FieldEditorUserControl  in /_CONTROLTEMPLATES/15/... all was good. Later on I had to also adjust the calls from other systems to custom web services deployed to Sharepoint layout folder, because they were no longer found at ../_layouts/webservice.asmx, they were at

So if you are migrating your custom solutions from SP2010 and get an error that says it cannot find some file and you are sure that it is there, check the way you are referencing those files and see if they are compliant with this new system.

No comments:

Post a Comment