I'm upgrading an C# application designed to create a SharePoint site on clients' servers. It used to run on WSS 3.0, but now is being upgraded to work with SharePoint 2013. To be clear, I am not migrating an existing site, but migrating a program designed to create the sites from scratch.
The current problem I am running into is with the 14/15 Hives on the created site.
The application manually copies the needed files into the hive for the targeted version of SharePoint (15).
When the site is created, however, the IIS virtual directory _layouts
points into the 14 hive.
_layouts/15
points into the 15 hive.
Rather than rewriting the URLs and code to run in 2010 compatibility mode, I'd just like to get everything running and pointing to the 15 hive, completely ignoring the 14 hive.
Right now, the C# code accesses the current farm with SPFarm.Local
, creates a SPWebApplicationBuilder
, uses that to create a SPWebApplication
, and adds a new site.
I have tried specifying the specific compatibility version in SPSiteCollection.Add
, and setting the SPWebApplication.CompatibilityRange
to SPCompatibilityRange.NewVersion
.
Neither has made any change.
I am not sure if I am supposed to change a setting in the farm, and, if I am, which setting and how to change it through the .NET API.
I've seen problems similar to mine reported before. I've seen references to some sort of 2010 compatibility mode that describes this behavior and how to enable it. I've seen a reference to changing a "solution's CompatibilityLevel flag", but I'm not entirely sure what a SharePoint solution is, and how to change these flags when creating the site through .NET.
I am not a SharePoint expert, so any advice would be greatly appreciated.
_layouts/...
. What would you recommend as best practice for this scenario? What should be done instead of copying? I did not create the original code, so I am completely unaware. How would I use the CompatibilityLevel flag to have the_layouts/XXX
always target the 15 hive?