Could load file or assembly Microsoft.IdentityModel.Tokens.dll/Microsoft.IdentityModel.Tokens.Jwt.dll - .net-standard-2.0

This is killing me. I have cleared out the offending packages, uninstalled the packages, reinstalled, attempted to add a <PackageReference>, tried targeting multiple frameworks with <targetFrameworks>... All of the things and I am still getting this error at runtime.
I have a .NET Standard 2.0 library that is being consumed by a .NET Framework 4.8 project. The framework project does not reference any of the IdentityModel.Tokens/Jwt objects. I have manually copied the assembly from the packages location in to the bin folder of the offending project and it does not seem to change the result.
Fusion Log
*** Assembly Binder Log Entry (1/7/2021 # 11:38:12 AM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable REDACTED\REDACTED\bin\Debug\REDACTED.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.IdentityModel.Tokens.Jwt, Version=6.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file: REDACTED
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = REDACTED.exe
Calling assembly : REDACTED.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: REDACTED\REDACTED\bin\Debug\REDACTED.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.IdentityModel.Tokens.Jwt, Version=6.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///REDACTED/REDACTED/bin/Debug/System.IdentityModel.Tokens.Jwt.DLL.
LOG: Assembly download was successful. Attempting setup of file: REDACTED\REDACTED\bin\Debug\System.IdentityModel.Tokens.Jwt.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: System.IdentityModel.Tokens.Jwt, Version=6.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Binding succeeds. Returns assembly from REDACTED\REDACTED\bin\Debug\System.IdentityModel.Tokens.Jwt.dll.
LOG: Assembly is loaded in default load context.

After getting an additional set of eyes on it, it turns out that the root project file (we do things a little differently) that references the .NET Framework project requires a reference to the assembly that wasn't being loaded.
Don't know why, but maybe something to do with MVVM and using a root project as a wrapper/driver for the application.

Related

Upgade app from 'EntityFramework, Version=4.6.1.0 to Version 6.3.1 or greater

I have existing app that uses MySQL Server. Some errors I was getting when trying to add a new feature led me to upgrading to 'MySql.Data.EntityFramework 8.0.11'.
error I am getting when on:
public CitiesContext() : base("name=CitiesContext"):
An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Under my properties, my target framework is still version 4.6.1.
Is there a 'how to document' somewhere on how to upgrade the EntityFrame work? I know several of the other installed packages were installed while targeting v 4.6.1, so lots of other types of errors using (like hay this was compiled with v 4.6) when trying to compile with a web.congf using
I have installed
PM> Install-Package EntityFramework -Version 6.4.4
Package 'EntityFramework.6.4.4' already exists in project 'Lat34North'
Time Elapsed: 00:00:00.0186347
Please note. This is a hobby for me, not a profession. The app is written using asp.net mvs an first issued in 2018. Do I just need to change the target in the properties and upgrade all the other packages??
Thank you for any help.

Error when trying to Scaffold a model

I'm building a Razor Page app using ASP.NET 2017. When I run the command
dotnet aspnet-codegenerator razorpage -m Activity -dc CongContext -udl -outDir Page\Activities --referenceScriptLibraries
This error appears:
Could not load file or assembly 'Microsoft.EntityFrameworkCore,
Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
The located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
I stopped and restarted VS, I've also cleaned and build the solution. Attached jpg shows the code I typed and the results
This is because of different versions of packages. Check the 'Dependencies' node of your project. The Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.Design must have same 2.0.3 versions.
If not, delete and re-add them from [Tools] menu > [Nuget Package Manager]. Also delete the Migrations folder and repeat instructions as listed here. For more info, you may take a look at this comment

Why json have version 10.0.1 and 9.0.1 but there is not version of 9.0.0.0

I spent more hours to fix this problem. I have research all ways in stackoverflow .I updated my json reference but. I couldn't solve this problem. Please help. Thanks in advance,Json version=9.0.0.0 is not fond.
Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' 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 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line 29:
Line 30:
Line 31: var message = MessageResource.Create(
Line 32:
Line 33: to: to,
Source File: C:\Users\TexnoUsta\Documents\Visual Studio
2017\Projects\SANTEKSolutions\SANTEK.Web\Controllers\SmsController.cs
Line: 31
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' 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:
Please help. Thanks in advance,Json version=9.0.0.0 is not fond.
Also if the version "9.0.1" exists, I would rather expect "9.0.0" than "9.0.0.0".
But according to github tags of source code: https://github.com/JamesNK/Newtonsoft.Json/tags, the "9.0.0[.0]" never existed, so you will never find it, unless you create your own.
Why? Ask the creator. But if the author of that package versions his code reasonably, then 9.0.1 should be minor bugfix of fictional 9.0.0, i.e. good-enough to be used by you as replacement for non-existing 9.0.0.0.
It looks like that web (?) already did use version 9.0.0.0 ... then ask the creator of the web, where did he get it from, maybe some custom creation, or from different company, building on the Newtonsoft.Json original, but releasing with different versions.

ASP.Net Could not load file or assembly MySql.Data

I have a ASP.Net website that connects to a MySQL data base to retrieve data. I have used NuGet to install mysql.data. Doing this added a Bin folder with the sql.data dll in it to my project. It added a reference in my web config file. and it added a packages.config to my project. All of this is expected i assume ? With these resources in place my website works when i run it from visual studio. The problem is when i upload it to a server i get the following error :
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
Source Error:
An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Source File: d:\DZHosts\LocalUser\bman262\www.brandonsLoginTest.somee.com\riviera horticulture\web.config Line: 7
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' 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].
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1069.1
This is saying it cant find the mysql.data reference right ? What am i doing wrong ?
Here are some pictures of my solution in visual studio and my web.config
Solution
Web.config
I am tearing my hair out over this, any help would be VERY appreciated
→ You will have to make sure that the same version is installed on the server where you are deploying your project.
→ If the server to which you are deploying your project is on 64 bit, you can enable 32 bit support for this site's application pool, if your dll requires 32 bit architecture.
For anyone using similar or the same host as me if you have this problem the solution was to convert the project file to an application on the server.

Play TypeSafe Activator fails to start - IllegalArgumentException "Failed to download new template catalog properties"

Moving from play 2.2.x to latest activator last night. Downloaded minimal 1.2.10, extracted it in program file (x86)\typesafe... and put the directory into the system path variable. cloned my repository, and when i executed activator run it downloaded the required modules and my app is up and running. All great so far. run works!
Then I tried to create a new app, and activator fails, with the following trace:
Checking for a newer version of Activator (current version 1.2.10)...
... our current version 1.2.10 looks like the latest.
Found previous process id: 9632
FOUND REPO = activator-local # file:////C:/Program%20Files%20(x86)/Typesafe/activator-1.2.10-minimal/repository
Play server process ID is 9760
[info] play - Application started (Prod)
[info] play - Listening for HTTP on /127.0.0.1:8888
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[WARN] [10/30/2014 10:47:13.972] [default-akka.actor.default-dispatcher-2] [ActorSystem(default)] Failed to download new template ca
talog properties: java.lang.IllegalArgumentException: requirement failed: Source file 'C:\Users\admin\.activator\1.2.10\templates\in
dex.db_6e0565f0c8826b17.tmp' is a directory.
[ERROR] [10/30/2014 10:47:13.972] [default-akka.actor.default-dispatcher-2] [akka://default/user/template-cache] Could not find a te
mplate catalog. (activator.templates.repository.RepositoryException: We don't have C:\Users\admin\.activator\1.2.10\templates\cache.
properties with an index hash in it, even though we should have downloaded one
activator.templates.repository.RepositoryException: We don't have C:\Users\admin\.activator\1.2.10\templates\cache.properties with a
n index hash in it, even though we should have downloaded one
at activator.cache.TemplateCacheActor.preStart(TemplateCacheActor.scala:184)
at akka.actor.Actor$class.aroundPreStart(Actor.scala:470)
at activator.cache.TemplateCacheActor.aroundPreStart(TemplateCacheActor.scala:25)
at akka.actor.ActorCell.create(ActorCell.scala:580)
at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:456)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263)
at akka.dispatch.Mailbox.run(Mailbox.scala:219)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
I've taken a look at several similar issues on SO and elsewhere. I've deleted .activator directory and retried, I've tried this process from behind a proxy and not, as well as offline (surely offline should work!), but it consistently gives the above error. activator ui gives the same error. I'm stuck and any suggestions would be appreciated. (Edit. tried with full activator download, rather than minimal, and I get the same error.)
Look for reasons it might be impossible to create or access 'C:\Users\admin.activator\1.2.10\templates\in
dex.db_6e0565f0c8826b17.tmp' ... maybe a permissions issue?
The failed check is for "is a directory" but that also fails if it just doesn't exist or can't be accessed.