Tuesday, March 27, 2007

Assembly Name or Codebase Invalid Errors

So I've finally recovered from a self-inflicted wound that's lost me more time than I'm willing to admit.  I’m working on a custom field type for MOSS and had been running in to issues when trying to create the field.  I kept getting the error:

The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

What was the cause?  See if you can spot the difference between:

<Field Name="FieldTypeClass">

    NuSoft.LinkedStandardsCFTField,

    LinkedStandardsCFT,

    Version 1.0.0.0,

    Culture=neutral,

    PublickKeyToken=9f4da00116c38ec5

</Field>

and this:

<Field Name="FieldTypeClass">

    NuSoft.LinkedStandardsCFTField,

    LinkedStandardsCFT,

    Version=1.0.0.0,

    Culture=neutral,

    PublickKeyToken=9f4da00116c38ec5

</Field>

Yes, it’s the missing equals sign in the version part.  OK, so I’m the dumbass who mistyped that, but wouldn’t it be great if the tools helped you figure out those sorts of errors before you build and deploy?

Leaving these sorts of important bits and pieces in free-text elements just doesn’t make sense to me.  Why not have them in a schema-defined structure, either as their own elements or attributes?

Bah.

8 comments:

Anonymous said...

Funnily enough your post help me track down a similar problem. It created the spark that allowed me find what had cost me a good few hours!

Cheers

Anonymous said...

Well, today you were someone's hero. Thanks! Thanks!

Anonymous said...

Oh, dude I had done almost exactly the same thing in an ASP.Net web.config file. In my case, I had replaced the "=" sign with a ".". Rather obvious when I saw it, but do you think I could spot it among all that clutter of XHTML? No way, no matter how hard I looked! Your comment is right on the mark. Thanks, you saved me some serious frazzling! D.S. in Halifax, NS

Anonymous said...

Ditto! Same exact problem as you had. So obvious when you see it; so elusive when you don't.

Anonymous said...

Wonderful post!
In my case it was a space in this

Version=2.0 .0.0

should be

Version=2.0.0.0

Darn thing Cost me a few hours!

Hilary

MacroSloth said...

Thanks so much. I did the exact same thing and couldn't see it till I read your post. It cost me an hour but I think you saved me a couple more.

Mr. Putty said...

Add me to the list of appreciative fans. I was missing a comma, but your example gave me an idea what I might be looking for.

Anonymous said...

I have been a dumbass too: Forgot the '=' ,... ;-)

Thanks for your post.

Michael B.

Subscribe (RSS)

The Leadership Journey