1

I am trying to use log4net.ThreadContext.Properties["subjectProperty"] = emailsubject in my project.

I have 2 differnt projects

  1. Web - MVC
  2. Business Layer

WEB - MVC project has reference to Combres

Business Layer has reference to log4net (here i have extended SMTPAppender for dynamic email address)

So at runtime I am having this error:

duplicate reference exists in Combres and log4Net for ThreadContext

I have added the extern keyword to resolve issue

I used the properties window to change the alias for the assembly from 'global' to 'MyAlias'

At the top of the file where the aliased assembly is used, I put extern alias MyAlias. This must be before any using statements.

I followed this:

Use the alias prefix to use the namespace you want, for example using MyAlias::MyNamespace.

But I have this error:

The extern alias 'xxx' was not specified in a /reference option

Lucas B
  • 69
  • 2
  • 7
swapneel
  • 3,061
  • 1
  • 25
  • 32
  • This is not a duplicate. answers http://stackoverflow.com/questions/2502640/the-extern-alias-xxx-was-not-specified-in-a-reference-option in this questions are not helpful for me .. – swapneel Feb 06 '12 at 15:41
  • So you've already edited the project file manually? – Ben Voigt Feb 06 '12 at 15:51
  • yes. Edited my Web project - still not working – swapneel Feb 06 '12 at 15:53
  • Is this an ASP.NET project then? That's important information which you NEED to add to the question. – Ben Voigt Feb 06 '12 at 15:55
  • Does it work from a "class library" project, which is in turn referenced by the web project? Reference aliases might not be supported by ASP.NET. – Ben Voigt Feb 06 '12 at 15:57
  • If I use it without Combres then it works. Combres also has reference to log4net! – swapneel Feb 06 '12 at 16:00
  • Possible duplicate of [Need a way to reference 2 different versions of the same 3rd party DLL](https://stackoverflow.com/questions/11550981/need-a-way-to-reference-2-different-versions-of-the-same-3rd-party-dll) – Orace Nov 20 '19 at 11:23

2 Answers2

1

I found that in my case the 2 assemblies in my solution that I was using the alias to differentiate had the same actual dll name, hence only 1 of the 2 assemblies was there.

Renamed to be

Interfaces.Beta1.dll

and

Interfaces.v1.dll

Then it all worked again! (not both of them being called Interfaces.dll)

Once I worked that out it seemed pretty obvious :)

BrianP
  • 11
  • 1
-3

Set the target framework to .NET 4.5.1.

JayC
  • 39
  • 4