Friday, October 28, 2011

The located assembly's manifest definition does not match the assembly reference

I installed some WSPs and came across these errors when trying to add some web parts:
The located assembly's manifest definition does not match the assembly reference


Error replacing my site web parts. You may need to perform this task manually. Microsoft.SharePoint.ApplicationRuntime.SafeControls+UnsafeControlException: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type is not registered as safe


There are many references to this everywhere. Typically this refers to a mismatch of a SafeControls directive in web.config and the actual DLLs loaded into the GAC, but in this case, they all match.

It turns out that my WSPs came from a ZIP file that was downloaded from the internet. As such, they were marked as unsafe. This caused DLLs to be marked as unsafe and were probably not loaded into the GAC properly. To work around this, unblock the zip file (or run streams to remove the blocks), uninstall the WSPs and then reinstall.

Monday, October 24, 2011

Changing welcome page without Publishing Feature enabled

I needed to change the welcome page on a site that did not have the Publishing feature enabled. Since that feature was not enabled, there was no Welcome Page option under Look and Feel. Rather than enabling and disabling the feature, I decided to do this through Powershell.

There are many references on how to do this including this forum post on "Change welcome page of a site collection using PowerShell"


$web = Get-SPWeb <my url>
$rootFolder = $web.RootFolder
$rootFolder.WelcomePage = "<my welcome page>"
$rootFolder.Update()

I tried to shorten it by doing the following
$web.RootFolder.WelcomePage = "<my welcome page>"
$web.RootFolder.Update()

Of course this didn't work because Update() will only work on an instance of RootFolder. It took me a while, but eventually I got it.

Saturday, October 22, 2011

Missing FAST Administration Links

I just upgraded some of my sites to SP1 + June CU and the Administration Links for FAST disappeared. Very simple fix described here: Updating SharePoint Server 2010 from RTM to December or later Cumulative Update disables FAST Search links in site collection administration (KB2521577)

Monday, October 17, 2011

Unable to install Hotfix for Microsoft Windows (KB976462)

While installing FAST Search for SharePoint, I came across this error:
Error: The tool was unable to install Hotfix for Microsoft Windows (KB976462). If Hotfix for Microsoft Windows (KB976462) is already installed you may need to uninstall it and run prerequisite installer again.

It turns out all I have to do is run the installer again since I was running Windows 2008 R2 SP1 which already has the necessary fixes.

Reference: KB2581903

Saturday, October 8, 2011

Formally learning SharePoint 2010

It's been a little over a year since I have started on SharePoint 2010. It was my first real exposure to SharePoint in any real depth (Yes, I have dabbled with SharePoint since STS, but never to an appreciable degree). Now I am planning to formalize some of my learning by taking a course and getting a certification. I figure the one I will go for is 70-667 TS: Microsoft SharePoint 2010, Configuring. Looking at the various offerings, it looks like the in class 10174 course is overkill (5 days, 9-5, $2000-3000). So, I have decided on the online collection 10278: Microsoft SharePoint 2010, Configuring course and supplement with various technet resources, virtual labs, other people's experiences such as How I passed SharePoint 2010 exam 70-667, and SharePoint 2010 Configuring 70-667 Exam Passed!.

Determining who has an open file handle on DLLs in the GAC

I recently needed to update a solution in my SharePoint farm however:
  1. The update required administration and connection permissions to the User Profile Service Application (UPA)
  2. Some assemblies in our solution was causing the the UPA to be inaccessible

So, my code is broken and needed update, my update is broken because it can't access UPA, my UPA is broken because of my code ... argh!

Then, I had this idea, figure out which DLLs were breaking the UPA and update those directly in the GAC, hoping that it will at least free up the UPA so the update. I figured my DLLs were reasonably compatible over the different versions. So this is what I did:
  1. Grab my updated WSPs
  2. Use 7-zip to open the WSPs and extract the DLLs I needed
  3. Open up the GAC (C:\Windows\Assembly)
  4. Copy the DLLs I need into the GAC
  5. Verify, by version number, that my DLLs were indeed copied into the GAC (I have seen cases where the copy seems to work, but nothing actually happens)
  6. iisreset
  7. restart owstimer
  8. Run my installer to update my code as normal.

This worked very well for me, but when a colleague tried it, he found that he was unable to get step 4 working. He kept getting access denied issues. It turns out that he had UAC turned on and some processes (not just iisadmin) had an open file handle on the very DLLs he needed to update. Getting around the UAC issue is just a matter of running things as administrator. To solve the file handle issue, we used Handle from Sysinternals

Now it was simply a matter of opening up a command prompt and doing something like this:
Handle.exe c:\Windows\assembly\gac_msil\<your DLL name>

Handle will also recurse into subdirectories for you! Now it's just a matter of stopping those processes and continuing on.