Visual Studio "Could not load file or assembly. Operation is not supported" error in Release mode

65

I have a small project in C# that uses two external dll files. One is the Redmine.Net.Api.dll and the other is NLog.dll. I'm using Visual Studio 2010. I added both files as Reference to my project. The problem is that when I run the project in Debug mode, it compiles, but when I switch to Release, it says:

Error 1 Could not load file or assembly 'file:///C:\project\lib\Redmine.Net.Api.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) C:\project\SGEN project

How can I fix this?

c#
visual-studio-2010
asked on Stack Overflow Feb 13, 2014 by svz • edited Feb 13, 2014 by svz

5 Answers

203

Did you download Redmine.Net.Api dll from the web? If yes, then browse to it with Windows Explorer, right click on it and choose properties. There you should click 'Unblock'. It might have been blocked for some reasons.

enter image description here

answered on Stack Overflow Feb 14, 2014 by MusicLovingIndianGirl • edited Oct 22, 2015 by MusicLovingIndianGirl
3

Found two items related to this one is saying to checking if your file is blocked (with some changed to your app.config) and another with changes to your project file. Hope this helps.

Link1

Link2

answered on Stack Overflow Feb 13, 2014 by Miguel • edited May 23, 2017 by Community
1

That occurred to me when I was debugging the remote code in release mode; changed it to debug mode and got it fixed.

answered on Stack Overflow Oct 24, 2018 by Avinash • edited Oct 24, 2018 by ayaio
0

I found the solution to this problem following the accepted answer in this post:

Use FuseLogVw to keep track of where your program is breaking and how it is breaking. This application has a table with lots of traces. Find out where the fault application is called and see what is wrong with it.

answered on Stack Overflow Feb 17, 2015 by Reudismam • edited May 23, 2017 by Community
0

Add <loadFromRemoteSources enabled="true" /> to your app.config file as shown below.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <runtime>
        <loadFromRemoteSources enabled="true" />
    </runtime>
    ...
</configuration>
answered on Stack Overflow Dec 28, 2016 by Matt Bonness

User contributions licensed under CC BY-SA 3.0