Could not load file or assembly 'ComponentSpace.SAML2

Hello,

I am new to using C# and componentSpace for SAML2 and have been tasked with debugging someone elses code. I have come across this error when trying to access the site through SAML2 and dont know what to do exactly:

Could not load file or assembly ‘ComponentSpace.SAML2, Version=2.6.0.17, Culture=neutral, PublicKeyToken=’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or assembly ‘ComponentSpace.SAML2, Version=2.6.0.17, Culture=neutral, PublicKeyToken=’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly ‘ComponentSpace.SAML2, Version=2.6.0.17, Culture=neutral, PublicKeyToken=’ could not be loaded.
WRN: Assembly binding logging is turned OFF.To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.Note: There is some performance penalty associated with assembly bind failure logging.To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace:
[FileLoadException: Could not load file or assembly ‘ComponentSpace.SAML2, Version=2.6.0.17, Culture=neutral, PublicKeyToken=’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] FormsTestApplication.TestUser.SendSSO(HttpContext context) +0 FormsTestApplication._Default.btnSubmit_Click(Object sender, EventArgs e) +1086 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11765069 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1665

This usually means that the ComponentSpace.SAML2 DLL used to build the application is different from the version available at runtime.
For example, if you built your application against v2.6.0.17 of the SAML2 DLL but at runtime v2.6.0.16 is available, you’ll get an error.
Please ensure that you build and publish your application including the SAML2 DLL.
This means a copy of the SAML2 DLL will be included in your application’s bin folder.
Also make sure that the SAML2 DLL hasn’t been published to the GAC on the target server.

[quote]
ComponentSpace - 7/24/2018
This usually means that the ComponentSpace.SAML2 DLL used to build the application is different from the version available at runtime.
For example, if you built your application against v2.6.0.17 of the SAML2 DLL but at runtime v2.6.0.16 is available, you'll get an error.
Please ensure that you build and publish your application including the SAML2 DLL.
This means a copy of the SAML2 DLL will be included in your application's bin folder.
Also make sure that the SAML2 DLL hasn't been published to the GAC on the target server.
[/quote]

Thank you, this was the reason I believed but its nice to get a confirmation. I will try this and update with the results.
[quote]
ComponentSpace - 7/24/2018
This usually means that the ComponentSpace.SAML2 DLL used to build the application is different from the version available at runtime.
For example, if you built your application against v2.6.0.17 of the SAML2 DLL but at runtime v2.6.0.16 is available, you'll get an error.
Please ensure that you build and publish your application including the SAML2 DLL.
This means a copy of the SAML2 DLL will be included in your application's bin folder.
Also make sure that the SAML2 DLL hasn't been published to the GAC on the target server.
[/quote]

If I use the nuget from Visual Studio 2.0.5 version would this be compatible with the 2.6.0.17 version that they are currently using?

The ComponentSpace.Saml2 package at https://www.nuget.org/packages/ComponentSpace.Saml2/ is a .NET Standard 2.0 library for ASP.NET Core.
It’s not the same as the v2.6.0.17 and later that target ASP.NET rather than ASP.NET Core.
The installer for the SAML v2.0 for ASP.NET includes the NuGet packages in the Bin folders.
You can configure a local NuGet package source in Visual Studio NuGet Package Manager to reference the local Bin folder containing the NuGet package.