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

the list cannot be displayed in datasheet view for one or more of the following reasons

For some very dumb strange reason Microsoft forgot about SharePoint datasheet view when developing Office 2010 64bit. I recently installed Windows 7 x64bit with Microsoft Office 2010 64bit. Now there are many people out there who dont recommend installing Office 2010 64bit (install 32bit instead) for various reasons but Microsoft continues to push us to 64 bit so why shouldn’t we make the most of costly Ram capacity.

 

If you are like me and have installed Office 2010 64 bit and utilise SharePoint 2007/2010 on a regular basis then you are bound to run into a very weird error. This error comes up when trying to edit a list in “datasheet view”, a common practice in SharePoint for bulk data management. Unfortunately, Microsoft forgot about this module and doesn’t install the required ActiveX object that comes with Office 2007 and Office 20010 32 bit.

 

To resolve this issue you simply need to download and install the link below. This basically installs the required files for Active X to run, storing them in the x86 programs files folder.

 

Please leave a comment if you run into this issue as well.

 

http://www.microsoft.com/downloads/details.aspx?familyid=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en

Sharepoint 2010 – Basic Powershell Commands

Below are the basics for installing sharepoint 2010 webparts using powershell.

 

  1. Open “Sharepoint 2010 Management Shell”
    image
  2. Add-SPSolution c:\wsps\contactus.wsp
  3. install-spsolution –identity contactus.wsp –webapplication http://moss-server –GACDeployment

    note: –GACDeployment is required if you are deploying to the assembly
  4. To update an existing web part you can run the following line
    Update-SPSolution –Identity SharePointProject2.wsp –LiteralPath c:\wsps/contactus.wsp –GACDeployment

Dont forget to activate your feature!

 

You can also add the following line to your ps1 files:

Add-PSSnapin “Microsoft.SharePoint.PowerShell”

This prevents the need for using SharePoint 2010 Management Shell. Just use normal powershell.

 

Installing Sharepoint 2010 on Windows 7 x64

The process for of installing sharepoint 2010 on windows 7 is rather simple unless you run into some issues as I did.

 

  1. Download or have ready sharepoint 2010.
    • On my development environment I just run sharepoint 2010 foundation server which can be download here.
  2. Then you want to follow the instructions found at the MSDN site http://msdn.microsoft.com/en-us/library/ee554869.aspx
  3. This all went pretty smoothly for me until I run the psconfig (Sharepoint Configuration Wizard) where I hit an error

An exception of type System.Security.Cryptography.CryptographicException was thrown. Additional exception information: The data is invalid.

Turns out that I needed to give my “Network Service” account full permissions to the 14 hive found at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14.
However this didn’t resolve the issue straight away and that’s when i found Bill Baer’s comment on the TechNet forum which says the following

Right click on the folder (‘%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14), select the Security tab, click Edit, click Add, as the user type “Network Service”, then click OK and apply. Grant the user Full Control. This will work on its own if you do it before running PSConfig.
If you’ve already hit the error, you may have to run psconfig –cmd configdb disconnect then delete the old configuration database from your SQL instance, then add the ACL and re run PSConfigUI.

After I had disconnected the database and manually deleted the config databases through Management Studio I was able to re-run the psconfig successfully.

Telerik Grid – Event Handlers

I am writting this article because its very common to use event handlers on grids and I find that im always forgetting how to access columns, rows data, datakeynames etc. So i have put together a list below of methods i commonly use.

 

OnNeedsDataSource

Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource

	RadGrid1.DataSource = New CommsBLL().GetInbox(HttpContext.Current.User.Identity.Name)

End Sub

 

ItemDataBound

This event is called after the row has been added to the grid allow you to access any controls/data that has been bound.

Access a column contents

Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

        'get grid row
        If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then
            Dim item As GridDataItem = TryCast(e.Item, GridDataItem)

            item("columnName").Text = "new value"
        End If
End Sub

Access DataKeyName and add new controls to column

Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

        If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then

            Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
            Dim status As String = item.GetDataKeyValue("status")
            Dim cell As TableCell = item("status")

            cell.Controls.Clear()
            Dim image As New Image
            If status = "Unread" Then
                image.ImageUrl = "/clips/icons/newmessage.gif"
            ElseIf status = "Replied" Then
                image.ImageUrl = "/clips/icons/replied.png"
            Else
                image.ImageUrl = "/clips/icons/readmessage.gif"
            End If
            cell.Controls.Add(image)

        End If

    End Sub

ItemCommand

Protected Sub FinancialsGrid_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles FinancialsGrid.ItemCommand

        If e.CommandName = "Delete" Then

            Dim item As GridDataItem = TryCast(e.Item, GridDataItem)

            Dim transactionID As Integer = item.GetDataKeyValue("TransactionID")

            'etc

        End If

    End Sub

Finally – Sope Website Goes Live!!

Its been a long time coming but finally my business, Sope Web Technologies, website has gone live, http://sope.com.au! With all our time focused on our customers it been hard to find spare time to focus on our own website…Please check out the website and let us know your feedback.

 

The website is built on top of the best CMS and collaborative platform currently available, Microsoft SharePoint 2010. This was our first real crack at 2010 so there were a few things we learnt which I will share in another blog post. SharePoint 2010 brings some huge enhancements from 2007 and it was very exciting to deep dive into this new functionality. I look forward to working with 2010 with our clients in the future!

Custom Templates in Sitefinity 3.6

Customising sitefinity templates is pretty easy these days and Joel wrote a great article on how to get started.

http://konecny.com/blog/blogSingle/09-03-08/Control_Templates_in_Sitefinity_3_6.aspx