Could not load file or assembly (nopcommerce 3.5) when changing to release
Asked Answered
U

5

6

I have a new nopcommerce 3.5 website that i want to publish and on debug it all was well but as soon i changed to release im getting this error

Error   1   Could not load file or assembly 'file:///C:\Users\User\Desktop\nop\packages\Autofac.3.5.2\lib\net40\Autofac.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)   C:\Users\User\Desktop\nop\Libraries\Nop.Services\SGEN   Nop.Services

and i looked all over the web and did all i could and it is just not working

what i did.

  1. clean and rebuild
  2. restart vs
  3. i re-downloaded a fresh copy of the code and the same happened
  4. deleted all the references and rebuilt
Umont answered 20/5, 2015 at 21:56 Comment(0)
U
6

OK here is how i solved it.

The files were locked by windows and its only visible in debug

I had to go to each .dll file that showed up in the error, and in the properties there was a button UNBLOCK and ones i applied the changes the errors was gone

Umont answered 21/5, 2015 at 20:8 Comment(2)
I had the same problem and this did solve it, however I had to unblock each dll manually. I wonder if there is a way to unblock all dll's in a given directory or project... this is extremely cumbersome.Vestavestal
i tried a few scripts and non of them did the trick, so i did each one and it worked.Umont
A
1

Instead of unblock all files one by one, you can do it from root folder by using Windows PowerShell:

dir D:\Projects\Nop -recurse | Unblock-File

Adulterate answered 16/8, 2015 at 7:34 Comment(2)
I tried it and it didn't unlock all the files, you can try it but if it does not work Check each fileUmont
The Unblock-File does not work in PS2.0, please help to check the version by this command: PS C:\Windows\system32> $PSVersionTable.PSVersionAdulterate
P
1

To unblock files use this command on Windows Powershell:

gci PASTE_FOLDER_PATH_HERE\*.dll -Recurse | Unblock-File

1) "gci" is used to load all files located under the specified path.
2) "-Recurse" is used to load files located in sub folders under the specified path.

Poleax answered 25/9, 2015 at 16:2 Comment(0)
S
0

Yes, It worked for me in a way right click on NopCommerce\packages\Autofac.3.5.2\lib\net40\AutoFac.dll then Unblock & finally click on OK, it will resolve this issue. I resolved this issue in this way.

Speaking answered 4/5, 2016 at 10:54 Comment(0)
S
0

https://mcmap.net/q/700053/-batch-file-to-unblock-files-copied-from-internet

get-childitem *.*| Unblock-File 

For those limited in their PowerShell options:

FOR %a in (*.*) do (echo.>%a:Zone.Identifier)
Sissy answered 22/7, 2016 at 3:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.