IntelliTect / AspNetCore.TestHost.WindowsAuth

Implements Windows authentication for ASP.NET Core TestServer-based integration test projects.
Apache License 2.0
25 stars 3 forks source link

Could not load file or assembly 'System.Security.Principal.Windows, Version=4.1.1.0 #9

Closed nadeemkhoury closed 5 years ago

nadeemkhoury commented 5 years ago

Hi, Thank you for the great job. I'm running a test project that build on .NET Framework 4.6.1. However, when I installed the project, It didn't install System.Security.Principal.Windows. I installed it manually version 4.5.1 in both projects, the Test project, and System Under test Project. When I tried to run the test, when it reach the following code var client = server.ClientForCurrentUser(); it throws an exception

Test method Zeva.WebConsole.Tests.UnitTest1.TestMethod1 threw exception: 
System.IO.FileLoadException: Could not load file or assembly 'System.Security.Principal.Windows, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

When I looked at my bin directory I found this version of System.Security.Principal.Windows: 4.6.26919.2.2 I added an assembly binding in my config file like this:

<dependentAssembly>
        <assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="4.1.1.0" newVersion="4.6.26919.2.2" /></dependentAssembly>

But It doesn't work.

Can you please help ? if it is not related to the library issues, feel free to close it.

Thanks

ascott18 commented 5 years ago

Take a look at https://github.com/dotnet/corefx/issues/34022 - that might be your issue.

Another point I would offer is that this is a netstandard2.0 library, but Framework 4.6.1 doesn't properly support netstandard2.0 - see footnote (2) on https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support. You may want to try upgrading to .NET Framework 4.7.2 if possible.

I'll leave this open for now, but I'm 99% sure that this isn't an issue with TestHost.WindowsAuth itself.

nadeemkhoury commented 5 years ago

Thank You Scott for your quick reply. I solved my problem by deleting the package and install it again and it worked properly. Thank you for the great job and have a nice day.