Matthew McDermott, MVP

General ramblings from a SharePoint MVP about SharePoint and Microsoft technologies related to collaboration, web content management and productivity.

"Could Not Load Type" Error

Recently I was working on a method to get a Flash file to read from a SharePoint list (more on that later…). I had a working solution, so I created my solution package and deployed it to our test servers. Rather than seeing my spiffy new application page (_layouts/catapult/spiffy.aspx) I received the following error:

"Could not load type."

Without going into all of the other solutions I tried, I found this post. I sat there for a minute and thought, how am I going to do that in a solution? I am almost done…it's almost Happy Hour!

A quick note to a trifecta of SharePoint Development Heroes (Robert Bogue, Scot Hillier, and Andrew Connell) and I learned that code behinds don't work in SharePoint unless you use the 4 part name to reference the assembly. So I changed the page directive in my aspx page from:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Spiffy.aspx.cs" Inherits="CatapultSystems.SharePoint.Applications" %>

To:

<%@ Page Language="C#" AutoEventWireup="true" Inherits="CatapultSystems.SharePoint.Applications.Spiffy, CatapultSystems.SharePoint.Applications, Version=1.0.0.0, Culture=neutral, PublicKeyToken=###########" %>

When I redeployed the page everything worked perfectly. I have never professed to be a "real" developer. I just stand in awe of guys like Robert, Scot, and Andrew who really have a deep understanding of what makes the technology tick. (And have the scars to prove it.)

BTW, Andrew has a great article on how you can use code behinds in SharePoint. Thanks Guys!

Posted by Matthew McDermott on Friday, 7 Dec 2007 06:27
3 Comments | Filed under: Development
Bookmark this post with:        

Comments

On 07 Dec 2007 08:50, AC [MVP MOSS] said:

Matt- To be clear, they always work, you just have to make sure you point to the assembly using the strong name.

On 08 Dec 2007 07:10, Matthew said:

Thanks AC, I updated the post to emphasize that point.

On 07 Oct 2008 12:42, Gregor Dzierzon said:

Solved my problem. Thanks for the post.

Leave a comment

Name (required)

Url

Email

Comments

Complete this section to post your comment