Invalid assembly public key

With some existing clients starting to migrate from SharePoint 2007 to SharePoint 2010 we ran into an issue installing our existing wsp solutions.

 

The way we write wsp’s is very manual in that everything is written from scratch and we use visual studio cab builder to write the wsp. I’m not too sure if this is just a coding mistake that SharePoint 2007 didn’t care about or whether its a property that has changed recently….(let me know if you have a reason)

 

So when we try to deploy to SharePoint 2010 using our powershell commands it errors out with:

 

Invailid assembly public key. <Exception from HRESULT: 0x8013141E>

image

 

Reason

This is our manifest file

 

<?xml version="1.0" encoding="utf-8" ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
          SolutionId="cf43760c-21e5-42a7-9b30-b7f956e6c267">
    <Assemblies>
        <Assembly DeploymentTarget="GlobalAssemblyCache" Location="SOPE.ListQuery.dll">
            <SafeControls>
                <SafeControl Assembly="SOPE.ListQuery, Version=1.0.0.0, Culture=neutral, PublicKey=5232633792b38efa"
                             Namespace="SOPE.ListQuery"
                             TypeName="*"
                             Safe="True"/>
            </SafeControls>
        </Assembly>
    </Assemblies>
</Solution>

 

Solution

 

Basically it doesn’t understand “PublicKey” and is looking for “PublicKeyToken”. Change the attribute name and rebuilding wsp resolves this issue.

 

<?xml version="1.0" encoding="utf-8" ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
          SolutionId="cf43760c-21e5-42a7-9b30-b7f956e6c267">
    <Assemblies>
        <Assembly DeploymentTarget="GlobalAssemblyCache" Location="SOPE.ListQuery.dll">
            <SafeControls>
                <SafeControl Assembly="SOPE.ListQuery, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5232633792b38efa"
                             Namespace="SOPE.ListQuery"
                             TypeName="*"
                             Safe="True"/>
            </SafeControls>
        </Assembly>
    </Assemblies>
</Solution>

 

 

I hope I have saved some one a little time 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: