-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not load file or assembly 'System.Runtime.Caching' Net Core 2.0 #5
Comments
That appears to be using the .NET 4.6.1 build, which uses the .NET Framework caching library. Try adding a reference to the Alternatively you might try explicitly using the |
I tried pulling the classes where i was using the Kerberos.Net library into a netstandard2.0 classlib but i was still getting the error when running a simple test in an xunit project. My current solution was just to roll back to nuget package version 1.5.820.1 which works correctly for now. It seems like nuget cant figure out how to bind the correct version of the assembly for netcoreapp2.0 or netstandard2.0 projects with the latest version of the nuget package. If i have some time tomorrow ill setup a project that recreates the problem and link it here. https://github.com/adragoset/Kerberos.Net-Test |
Hmm odd. I wonder if something extra has to be done for xunit to run it. I've used this latest package on a netstandard2.0 project and it worked without issue so I think it could be localized to the tests. I did try out your project and it seems to have worked:
|
My Test is a negative test case so a passed result means the library failed with FileNotFound exception. I cloned Kerberos.Net and ran your tests and those all pass. I suspect that somehow the multi target nuget package is getting mangled or not working correctly rather than there be an issue with the projects code itself. Your project definition and compiler directives look correct however at least according to microsofts documentation on building multi target nuget packages for .net core. |
Was the original error showing up in the web API app, or just the tests? |
I haven't reached a point in the webapi project where i can do a live test yet mainly because of external dependency on adfs infrastructure that i don't have direct control over configuration on and a handful of other auth services im trying to wrap behind the webapi micro service. Was attempting to mock all that stuff in unit and integration tests. |
I was able to reproduce it by just creating a netcoreapp and trying to create an instance of the TicketReplayValidator class, which fails with a compiler error because it's using the net46 build and that class is internal in net46. I'm not sure why it's doing that. I've created a Stack Overflow question to see if anyone else has any ideas: https://stackoverflow.com/questions/47098227/nuget-package-targets-net-framework-and-net-standard-2-0-but-standard-projects |
We are facing the same issue. Is there a resolution around this? |
Last I looked, it's a build packaging issue. It's placing the net46 DLL into the Core folder, so it's screwing with references. I haven't had a chance to look into it recently so I will find some time in the next week. In the mean time you can build the project locally and it'll output the right files. |
This is fixed now. The build output path was causing the same DLL to be used in both locations. You can find these changes in the latest nuget package: 2.1.509.2 |
I get the following exception when calling
await authenticator.Authenticate(token);
in a netcoreapp2.0 webapi application.
---- System.IO.FileNotFoundException : Could not load file or assembly 'System.Runtime.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Im using nuget package
<PackageReference Include="Kerberos.NET" Version="1.5.821.1"/>
Seems like the nuget package is binding to the assembly for net46 applications and not .net core 2.0 apps.
The text was updated successfully, but these errors were encountered: