System.IO.FileLoadException: 'Could not load file or assembly 'EntityFramework or one of its dependencies. Access is denied.'

2

System.IO.FileLoadException HResult=0x80070005 Message=Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Access is denied.

I understand that this is a common issue however my situation is different. I downgraded the .net version that my program was using and cleaned and rebuilt the solution. I now get that error message as soon as I try to start the program.

I have tried the following:

  • rebuilt and cleaned solution
  • Deleted bin folder and rebuilt
  • Deleted entity framework reference and added it again
  • Set permissions for all users to full control for all folders and subfolders
  • Ran SysInternals Process Monitor and didn't see an Access Denied status anywhere
  • Tried to downgrade entity framework version
  • Created a brand new project and copied the files over and still getting the same error message
  • Restarted visual studio
  • Ran visual studio as administrator
  • Went back to the original .net version that my program was using
  • Deleted and reinstalled the nuget package

Where do I go from here? Nothing from any posts I see on this website is fixing this issue.

UPDATE: This is a screenshot from a program that uses the same version of entity framework and it is currently working and below is a screenshot of the program where I can't get it to work. You can see the different icons in the working version so my only guess is that it is related but I don't know what the blue symbols mean. Any guesses?

working program

program that isn't working

c#
entity-framework
asked on Stack Overflow Sep 24, 2018 by user3610374 • edited Sep 24, 2018 by user3610374

1 Answer

3

If it's a web app

  1. CMD as admin and run IISReset command if you don't use IISExpress
  2. You should clear the .net cache manually delete the temp folder on the Microsoft.Net folder on windows https://stackoverflow.com/a/17651986/1979151
  3. Change the platform target from 64 to 32 to AnyCPU
  4. Try to enable 32bit apps on the app pool advanced settings
  5. For sorry, Restart the machine

I hope that can help you

answered on Stack Overflow Sep 24, 2018 by Nabawoka

User contributions licensed under CC BY-SA 3.0