简体   繁体   中英

Dynamics CRM 2013 SDK helper code not compiling

The Dynamics CRM 2013 SDK comes with a few helper classes (not a solution, just .cs files) that reference among other things Microsoft.IdentityModel and System.IdentityModel. The CRM 2011 guide for using these classes can be found here ( http://msdn.microsoft.com/en-us/library/gg328228.aspx ), no guide for 2013 yet. I am unable to build a .NET 4.5 library project because of the ambiguity of the two different IdentityModel references.

The first error I am getting after following the guide 1:1 is "SecurityToken" could not be found. The new CRM 2013 classes have using System.IdentityModel.Tokens at the top, so I add a reference to (not mentioned in CRM 2011 link) System.IdentityModel. Then I get 14 errors like this

'WSTrustChannelFactory' is an ambiguous reference between 'System.ServiceModel.Security.WSTrustChannelFactory' and 'Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannelFactory'

Has anyone been able to successfuly build and use the helpers for CRM 2013? Was my decision to add the last reference wrong?

I tried to build a project with the WsdlTokenManager class from the SDK samples now and I had to reference both Microsoft.IdentityModel and System.IdentityModel .

In the code file I had to add these two usings:

using WSTrustChannel = Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel;
using WSTrustChannelFactory = Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannelFactory;

So now it compiles, but I have not tried running the code to authenticate a user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM