0

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.

2
  • Seems a bit of an unusual application as provisioning a Web Application is a once in a blue moon operation, otherwise you're going to quickly run into a boundary limit (not to mention poor architecture). That said, you need to use the CompatibilityLevel flag to target the specific hive. And of course, copying files into the hive is also poor practice.
    – user6024
    Commented May 7, 2017 at 0:33
  • @TrevorSeward I am upgrading the installer for an intranet web application our company sells which uses SharePoint as its backend (a poor decision, I know). Our clients will use the installer to set up the SharePoint site the application uses. I do not want to change the many hardcoded URLs in the application resembling _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?
    – Kupiakos
    Commented May 7, 2017 at 0:39

1 Answer 1

0

You can add SharePoint product Version="15.0" attribute in Solution's manifest.xml file to force it to deploy in 15 Hive instead of 14 Hive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.