SOLVED

The type or namespace name 'S2S' does not exist in the namespace 'Microsoft.IdentityModel'

Copper Contributor

I'm new to development against the PnP-Sites-Core solution. After downloading the solution from GitHub, the initial build fails and I'm not sure why. The restoration of all Nuget packages seems to work, but I can't build the solution because "The type or namespace name 'S2S' does not exist in the namespace 'Microsoft.IdentityModel'."

 

I can't figure out what assembly reference I'm missing or what I'm doing wrong. Any ideas?

7 Replies

Hi @Eric Skaggs,

 

Can you check the reference to Microsoft.Identity Model?

 

In my case it is set to:

C:\WINDOWS\assembly\GAC_MSIL\Microsoft.IdentityModel\3.5.0.0__31bf3856ad364e35\Microsoft.IdentityModel.dll

 

What version of the Nuget package have you got installed for Microsofty.IdentityModel?

 

The problem appears to be related to Microsoft.IdentityModel.Extensions. Maybe @Erwin van Hunen or @VesaJuvonen can help? Smiley Happy

 

I am running the code as-is from GitHub. The reference to Microsoft.IdentityModel in my local copy is C:\Program Files\Reference Assemblies\Microsoft\Windows Identity Foundation\v3.5\Microsoft.IdentityModel.dll. I changed it to match what you have and that did not make any difference.

 

There is no Nuget package for Microsoft.IdentityModel in the solution, so I did not install one. Here are the steps I'm taking.

 

  1. Download PnP-Sites-Core as a .zip from GitHub: https://github.com/SharePoint/PnP-Sites-Core.
  2. Extract the files somewhere locally.
  3. Open OfficeDevPnP.Core.sln in Visual Studio 2015 Community Edition (running as admin)
  4. Build the solution.
    1. Nuget packages are restored
    2. Build fails
    3. Solution Explorer indicates that it can't find Microsoft.IdentityModel.Extensions

2017-01-04_8-58-05.png

 

Where can I get Microsoft.IdentityModel.Extensions? There is a Nuget package for that, but it's not supported by Microsoft and therefore we can't use it with this solution.

 

2017-01-04_9-01-34.png

We are aware of the issue. The file gets installed the moment you install the office developer addons in Visual Studio. So if you have a 'clean' VS installation the file is not there unfortunately. I will discuss this with the team.

I was able to resolve by installing the Office Developer Tools.  Noticed Windows Idenity stuff installed on confirmation screen (see attachment).

best response confirmed by Eric Skaggs (Copper Contributor)
Solution

We now removed the dependency to Microsoft.IdentityModel.Extensions and replaced it with our own, which will be distributed with PnP Core. As of the next release the requirement to install the Office Developer Tools will be gone.

Trying to follow sample code within Office Dev Center.

 

Having the same issue in that the SharepointContextToken; SharepointContextProvider is not recongized.  I have added the Microsoft Identy Model and the mentioned SharepointPNP Identy Model Extensions as explained above to my project.

 

Does the sample code need to change?  Its location is here:

https://dev.office.com/sharepoint/docs/sp-add-ins/get-started-creating-provider-hosted-sharepoint-ad...

@Lisa Mendez 

 

You need to use NuGet in your solution and add Microsoft.Identity.Model.Extension.  You can do this from within visual studio starting with 2017.  I just did it with 2019 and now the sample app compiles.  Hope you found the solution, since you posted this question 2 years ago.  

1 best response

Accepted Solutions
best response confirmed by Eric Skaggs (Copper Contributor)
Solution

We now removed the dependency to Microsoft.IdentityModel.Extensions and replaced it with our own, which will be distributed with PnP Core. As of the next release the requirement to install the Office Developer Tools will be gone.

View solution in original post