2

I have a custom WSP with (among other things) a user control and a DLL for GAC deployment. It's been built for SharePoint 2010 and .NET 3.5 and is fully working on my SharePoint 2010 Farm.

I also have a new SP2013 farm and installed the same WSP using:

Add-SPSolution -LiteralPath C:\WSPs\mypackage.wsp
Install-SPSolution -Identity "mypackage.wsp" -WebApplication http://mywebapp -GACDeployment

This gives no errors. I have attached my 2010 content database, ran test-spcontentdatabase with no errors and have mounted it to the 2013 web app. No worries so far.

When opening the page where I expect to see the user control, I receive the error "Could not load type 'MY.DLLname'. This is the DLL contained in the WSP and referenced by my user control.

The DLL IS present in the "old" gac: c:\windows\assembly, but NOT present in the .net 4.5 gac, which is expected (I guess).

Why isn't this working? Are SharePoint 2013 sites running in "2010 mode" only looking for dll's in the "new" GAC? If so, what is the correct deployment procedure for legacy 2010 WSPs containing assemblies?

  • Hey did you find any solution to this. I am having same issues. – Nadeem Yousuf-AIS Jan 20 '14 at 12:19
  • Yes, I belive so, I will add my answer below. Let me know if it's not working for you, and I will try to find my notes from back when I had this issue. – anderaus Jan 20 '14 at 16:50
  • Thanks looking forward to your resolution to this issue. – Nadeem Yousuf-AIS Jan 20 '14 at 17:09
2

The issue was resolved by adding a strong-name assembly reference in the ascx file pointing to the code-behind assembly.

If your ascx file's assembly references do not include strong-name, like this:

<%@ Control Language="C#" AutoEventWireup="true" 
CodeBehind="SomeFile.ascx.cs" Inherits="SomeNameSpace.SomeClass" %>

Try adding a full assembly reference, like this:

<%@ Assembly Name="SomeAssembly, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Which for SharePoint can be achieved using this token (if the current project assembly is the issue):

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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