Tallan's Technology Blog

Tallan's Top Technologists Share Their Thoughts on Today's Technology Challenges

Identity Developer Training Kit and an issue with missing dependencies

If you are learning about Windows Identity Foundation, you should install these components in the following order:

Note that there is a version of the SDK and Training Kit for Visual Studio 2008 SP1 (.NET 3.5) and one for Visual Studio 2010 (.NET 4.0.)

Note: Side by side installation of the WIF 3.5 and 4.0 SDKs is not recommended. Visual Studio templates will be properly installed for side by side installations of Visual Studio 2008 and 2010, the included samples will not work in such a configuration without modification.

This post is about a problem I found with the 2008/3.5 version of the Identity Training Kit and how you can fix an error in the lab set-up scripts.

Each training lab has a SetupLab.cmd file that needs to be run in order to install and configure the code snippets and certificates for that lab. For the first hands-on lab, Web Sites and Identity, this can be found at \IdentityTrainingKit\Labs\WebSitesAndIdentity\Source\Setup

image

When you run this batch script (with elevated administrator permissions), it runs a configuration wizard that checks for all prerequisites: PowerShell, Visual Studio, SQL, IIS7, WCF HTTP Activation, WIF.

Unfortunately, it complains about the WIF SDK not being installed even though it is.

image

I verified that the SDK was properly installed in Control Panel > Programs and Features. I tried reinstalling the SDK but that didn’t fix the error.

image

I did some investigating in the content of the TrainingKit and followed a trail of folders (IdentityTrainingKit\Assets\DependencyChecker\scripts\dependencies\check) to this set of PowerShell scripts…

image

Open up CheckWifSdk.ps1 and you will find the culprit

function SearchUninstall($SearchFor, $SearchVersion, $UninstallKey)
{
$uninstallObjects = ls -path $UninstallKey;
$found = $FALSE;
[reflection.assembly]::LoadWithPartialName("System.Version");
foreach($uninstallEntry in  $uninstallObjects)
{
   $entryProperty = Get-ItemProperty -path registry::$uninstallEntry
   if($entryProperty.DisplayName -like $searchFor)
   {
       $vc1 = new-Object System.Version($entryProperty.DisplayVersion);
       $vc2 = new-Object System.Version($searchVersion);
       if($vc1.CompareTo($vc2) -ne -1)
       {
         $found = $TRUE;
         break;
       }
   }
}
$found;
}
$res1 = SearchUninstall -SearchFor 'Windows Identity Foundation SDK' -SearchVersion '6.1.7600.113' -UninstallKey 'HKLM:SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\';
$res2 = SearchUninstall -SearchFor 'Windows Identity Foundation SDK' -SearchVersion '6.1.7600.113' -UninstallKey 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\';
(($res1 -eq $TRUE) -or ($res2 -eq $TRUE))

The culprit is in the last section. Change 6.1.7600.113 to 6.1.7600.16436 AND Windows Identity Foundation SDK to Windows Identity Foundation SDK 3.5 in both SearchUninstall statements (one checks for the x86 version while the other looks for the x64 version of the SDK)

You can verify the version number and display name by checking the detail info in Control Panel > Programs and Features (see screenshot above) or by checking the registry paths the PowerShell script uses.

HKLM:SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\
or

HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

Re-run setupLab.cmd and you should be able to proceed to the remainder of the set-up. Follow the recommended steps described in the Overview of each Lab.

image

3 Comments. Leave new

A more correct fix would be to change line 9 of the CheckWifSdk.ps1 script from:

if($entryProperty.DisplayName -like $searchFor)

to:

if($entryProperty.DisplayName -match $searchFor)

That change will allow the script to work properly regardless of version.

Nice post – exactly what I was looking for on my first google click…I used the comment suggestion and it worked perfectly.

One wonders why Microsoft hasn’t fixed their script.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>