Updating SharePoint 2010 custom solutions to SharePoint 2013

When opening a Visual Studio 2010 solution in Visual Studio 2012 for use in SharePoint 2013 we get this upgrade log saying we didn’t get any errors and a copy of your project was saved.

image1

But is everything error free as it says? Lets try and deploy this solution. It worked in 2010 why not in 2013? Well as expected it doesn’t work. It won’t even build. You get this cool error.

“C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3258: The primary reference “Microsoft.SharePoint” could not be resolved because it has an indirect dependency on the .NET Framework assembly “X” which has a higher version “4.0.0.0” than the version “3.0.0.0/ 3.5.0.0” in the current target framework.”

Well this means something is wrong with the references in our project. When opening the properties of our project we can clearly see that is still set to .Net Framework 3.5.

 

image7

But wait… why can’t we select another .Net Framework? If we could select the correct one then we could build the solution.

The solution to fix this is to open the .csproj file with notepad and to manually remove this GUID: {BB1F664B-9266-4fd6-B973-E1E44974B511}. This will prompt to reload the project and now you can select the correct .Net Framework. Now we can build the solution.

But wait… what happens now… we can’t deploy the solution anymore. It’s like Visual Studio has forgotten that it’s a SharePoint project. Lets get back to the .csproj file.

Comparing it to file from a new project some parts have changed. Instead of the {BB1F664B-9266-4fd6-B973-E1E44974B511} GUID there is now another one. {C1CDDADD-2546-481F-9697-4EA41081F2FC}. so put this one in place of the one you deleted. Also something has been added to the file.

<TargetOfficeVersion>15.0</TargetOfficeVersion>

And change the SharePoint Product version in your package to 15.0

 

image10

Now you can deploy your solution.

And remember that in .Net 4.5 the GAC assembly is moved. So your .dll files won’t be visible in the GAC anymore. There’s a new location “C:\Windows\Microsoft.NET\assembly\GAC_MSIL” where you can find a folder that has the name of your solution. Inside that folder you find a folder with a strange name. If your wondering what the “PublicKeyToken” of your solution is well its in the name of the folder. Inside this folder is your .dll file

One Comment

  1. Thank you for your post.\r\nThe GUID has been changed after upgrade and the ( C1CDDADD-2546-481F-9697-4EA41081F2FC ) can I get from new project , can you please specify the location\r\n\r\nAre you mean to re-add the dll files?

Leave a Reply

Your email address will not be published. Required fields are marked *