Regarding the sample code provided for Microsoft.ResourceManagement.clien

Jun 24, 2010 at 5:32 AM
while implementing the code.. ContextualSecurityToken objects and ContextMessageProperty parameters These parameters are not class defination.. how can we get them.. ??
Jun 24, 2010 at 5:42 AM

Hi Iohia,

Are there any unresolved references when you load the project in Visual Studio?

Are you getting any errors when you recompile the project?  

Please send us more information.




Jun 24, 2010 at 5:48 AM
Hi Jeremy, There are lot of unsolved references when i load the project in visual studio. For the class named "ContextualSecurityToken" these is no assembly reference... For the class named "ContextMessageProperty" there is no assembly reference. Am i missing out some webservice reference or some namespace?? regards, Lohia
Jun 24, 2010 at 5:58 AM
Edited Jun 24, 2010 at 6:02 AM

The ContextualSecurityToken is in the Microsoft.ResourceManagement.dll that ships with FIM. Can you see if your Visual Studio solution has a broken reference to this DLL or if this reference is missing?



Jun 24, 2010 at 6:08 AM
hi Jeremy, I cannot find Microsoft.ResourceManagement.dll reference, as the machine which i m working on is not the same machine where FIm is installed. Its some other machine within the domain of the FIM service. Is there any way to get the reference to this dll from some other machine withn the domain of the FIM service. -Lohia
Jun 24, 2010 at 8:18 AM

You could copy the DLL from your FIM server to your development machine and then remove/re-add the reference in the Microsoft.ResourceManagement.Client project.

Jun 24, 2010 at 8:22 AM
Hi Jeremy, Thank you for the help. It Worked. -Lohia
Jun 24, 2010 at 10:14 AM
hi Jeremy, I have included the namespace "System.ServiceModel.Channels" .. still i am getting an error for .. "ContextMessageProperty" no assembly reference "EndpointAddress" no assembly reference. can you tell me the reason for it...??? - Lohia
Jun 24, 2010 at 4:05 PM

Not sure what the problem is.

Try removing/re-adding the reference to System.ServiceModel.Channels.

ContextMessageProprty is defined in SystemServiceModel.Channels. EndpointAddress is defined in System.ServiceModel.


Jun 25, 2010 at 5:06 AM
Thanks Jeremy.. Got them finally working.
Jun 25, 2010 at 6:25 AM
hi Jeremy, while runing the application i got teh following error.... {System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ResourceManagement, Version=4.0.2560.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.ResourceManagement, Version=4.0.2560.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.ResourceManagement.Client.DefaultClient.Put(RmResourceChanges transaction, Boolean useAlternateEndpoint, PutResponse& response, SecurityToken token, ContextMessageProperty context) at Microsoft.ResourceManagement.Client.DefaultClient.ResetPassword(RmResource user) in c:\testfimquerytool-41220\FimCommunity\FimPublicWsClient\Microsoft.ResourceManagement.Client\DefaultClient.cs:line 390 at test1.Form1.runQuery() in C:\testfimquerytool-41220\FimCommunity\FIMQueryTool\test1\Form1.cs:line 431 === Pre-bind state information === LOG: User = TEST\Administrator LOG: DisplayName = Microsoft.ResourceManagement, Version=4.0.2560.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///C:/testfimquerytool-41220/FimCommunity/FIMQueryTool/test1/bin/Debug/ LOG: Initial PrivatePath = NULL Calling assembly : Microsoft.ResourceManagement.Client, Version=, Culture=neutral, PublicKeyToken=70581945bf94186a. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\testfimquerytool-41220\FimCommunity\FIMQueryTool\test1\bin\Debug\test1.vshost.exe.config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.20506\config\machine.config. LOG: Post-policy reference: Microsoft.ResourceManagement, Version=4.0.2560.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///C:/testfimquerytool-41220/FimCommunity/FIMQueryTool/test1/bin/Debug/Microsoft.ResourceManagement.DLL. LOG: Attempting download of new URL file:///C:/testfimquerytool-41220/FimCommunity/FIMQueryTool/test1/bin/Debug/Microsoft.ResourceManagement/Microsoft.ResourceManagement.DLL. LOG: Attempting download of new URL file:///C:/testfimquerytool-41220/FimCommunity/FIMQueryTool/test1/bin/Debug/Microsoft.ResourceManagement.EXE. LOG: Attempting download of new URL file:///C:/testfimquerytool-41220/FimCommunity/FIMQueryTool/test1/bin/Debug/Microsoft.ResourceManagement/Microsoft.ResourceManagement.EXE. } can you suggest something... - Lohia
Jun 28, 2010 at 4:14 PM

Hi Lohia,
sorry for not answering sooner, I've been very busy recently.

I would guess that the assembly binding exception that you are getting is due to the assembly version: 'Microsoft.ResourceManagement, Version=4.0.2560.0, ...'
The version of the assembly you built the code with and the assembly on the machine where you run the application are different. Check what is installed in the GAC of the machine running the command "gacutil -l Microsoft.ResourceManagement" from a Visual Studio command prompt. You should see something like this:

C:\>gacutil -l Microsoft.ResourceManagement
Microsoft (R) .NET Global Assembly Cache Utility.  Version 3.5.30729.1
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  Microsoft.ResourceManagement, Version=4.0.3531.2, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL

Number of items = 1

You can do two things:

1) pick up the correct reference in your project and build against that (the easiest solution).

2) add assembly redirection to your application configuration file. Check C:\Program Files\Microsoft Forefront Identity Manager\2010\Service\Microsoft.ResourceManagement.Service.exe.config, you will see in the <runtime> section something like:
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="Microsoft.ResourceManagement" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="" newVersion="4.0.3531.2" />
this is instructing the .NET runtime to use version 4.0.3531.2 (replace with appropriate version) of Microsoft.ResourceManagement whenever another version is required.

Hope this helps,


Jun 29, 2010 at 5:10 AM
hi Paolo, Thank you so much for replying back ..... After running the command... "gacutil -l Microsoft.ResourceManagement" I got this... Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.20506.1 Copyright (c) Microsoft Corporation. All rights reserved. The Global Assembly Cache contains the following assemblies: Number of items = 0 Let me tell you that I have copied the dll "Microsoft.Resourcemanegent" from a machine which runs FIM. I have kept this dll in the location "C:\Program Files\Microsoft Forefront Identity Manager\2010\Service\" The machine which i m using does not have FIM installed in it. Regards, Ravi Lohia
Jun 29, 2010 at 5:47 AM
hi paolo, I also tried installing "Microsoft.ResourceManagement.dll" using the command : C:\> Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe .\Program Files\Microsoft Forefront Identity Manager\2010\Service\Microsoft.ResourceManagement.dll
Jun 29, 2010 at 9:04 AM

Dear Lohia,
to install an assembly in the GAC you have to run the command

gacutil -i Microsoft.ResourceManagement.dll

You can have a look at this msdn entry (and related ones) to get an idea of how the .net framework locates assemblies: Working with Assemblies and the Global Assembly Cache.
Alternatively, you can copy the dll in the folder where your application is running.


Jun 29, 2010 at 9:39 AM
Hi Paolo, It worked .. thanks a lot... After installing the dll, referenced those dll in my sample client application. But its still not compiling.. the reason being because of "Microsoft.ResourceManagement.dll" it is conflicting with "Microsoft.ResourceManagement.Client.dll" How can I solve this problem. Regards, Ravi Lohia
Jun 29, 2010 at 9:44 AM
The primary reference "C:\testfimquerytool-41220\FimCommunity\Ensynch.FIM\Ensynch.FIM\bin\Debug\Ensynch.FIM.dll" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Management, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which has a public key token of "B03F5F7F11D50A3A" and has been located in the GAC or AssemblyFolders search locations. The assembly has been added to an exclusion list. Assemblies with this public key token should not be resolved from the GAC or the Assemblyfolders search locations. If this reference is required change the reference include to a fusion name and set <SpecificVersion> metadata to true.
Jun 29, 2010 at 10:44 AM
Hi paolo, Hey i got the errors resolved. Kindly, ignore the last two posts.. Regards, Ravi Lohia