Alex Rivera | Logout

Adding same "*.dll" reference to multiple projects in the same Solution

Asked 2011-01-14T14:37:23.823
11

I have a Visual Studio 2008 .NET C++/CLI Solution. My solution consists of many sub projects. I define a custom build directory for each project and called it "Output".

My solution:

  • MyFirstProject (*.exe)
  • MySecondPrject (*.dll)
  • ...
  • MyNthProject (*.dll)

Each of the sub project use Log4.net.So I create a directory (called LogBinary) and put log4.net DLL in that folder. Then to use log4net I add this DLL as a reference to each of my project.

But when I try to compile my main project (*.exe) I got tons of warning (over 400).

Just an example:

Warning 110 warning C4945: 'AbsoluteTimeDateFormatter' : cannot import symbol from 'somepath\log4net.dll': as 'log4net::DateFormatter::AbsoluteTimeDateFormatter' has already been imported from another assembly 'log4net'"somepath\log4net.dll"

Lots of warnings with:

has already been imported from another assembly

Why do I get these warnings? Does anybody have a solution to add same DLL to multiple projects (except using GAC)?

Edit
Report

2 Answers

1

Change reference on the projects, set all "copy local ..." properties to false.

Source : http://developertips.blogspot.com/2008/07/ccli-warning-c4945.html

answered 2011-01-18T22:58:00.893
0

I had this exact same problem. It is caused by the following situation, where a project depends on another project:

my_solution -> System.Xaml.dll -> System.dll
my_solution -> System.dll

When I removed the reference to System.dll (for instance) it solved the compiler warning.

answered 2011-06-15T18:21:27.210

Your Answer