Reputation: 301
I have a simple C#/4.0 console app that reference Log4Net 1.2.13.0 in VS2010.
In debug mode the app compiles and runs fine on my machine. However, as soon as I change to 'Release' I get the error
"Could not load file or assembly 'file:///C:\Users\mike\Documents\Visual Studio 2010\Projects\xxxx\yyyyy\log4net.dll' or one of its dependencies. Operation is not supported."
In the AssemblyInfo.cs I have added the line:
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
According to the configuration mgr, but Debug and Release are set to use platform x86. This is also happening in another C# service application on my laptop, but I thought it easier if stick with getting it working here first.
The app.config file contains a section for:
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
Thanks in advance Mike
Upvotes: 6
Views: 1603
Reputation: 1
I too had the same issue. I just checked the Unblock checkbox at the properties of log4net.dll which resolved the issue for me.
Upvotes: 0
Reputation: 301
Changing the type definition in the app.config
to specify the fully qualified assembly name resolved the issue for me:
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a" />
Upvotes: 1