views:

1687

answers:

7

i've added a reference to the log4net assembly dll to my project.

When i build i get a warning saying:

Warning Assembly 'Lib\log4net.dll' is incorrectly specified as a file.

i look up the help for this error on MSDN, and it says:

This warning is generated during application manifest generation when the build process detects that a file reference is actually a (managed or native) assembly.

This is exactly what i'm doing; the file reference is an assembly. What am i being told here?

How do i add a reference to an assembly dll, while not adding a reference to an assembly dll?

+1  A: 

Perhaps this link might help.

Andrew Hare
A: 

Perhaps this link might help.

The author says don't call the folder "Includes" that contains the dll.

In my case the folder is called "Lib" (which is what the author renamed his folder to make it work)

Ian Boyd
-1 for stealing from another answer.
tsilb
Link this other answer - perhaps you can be helpful.
Ian Boyd
+1  A: 

It sounds like VisualStudio is assuming you have a file reference (like a .txt or .bmp) instead of an assembly reference. In the File Type property of your reference, does it show "Assembly" or something else?

Is this a Windows app, service, or website?

Pedro
+1  A: 

I was running into this problem myself.

This is what worked for me:

I had added an assembly as a reference and as an "Existing Resource." Deleting the file from the Solution Explorer, closing, then reopening the project worked.

jadelane
A: 

The author said renaming the folder to libs didn't work, he goes on to say the the actual fix was to set the build action to none and copy if newer for each of the dll’s generating this warning.

Except that if you are publishing, then setting Build Action to None means that it won't be published
Frep D-Oronge
A: 

You have added this file to Includes beforehand and the reference to it is still in the Manifest? Can you add the file with a different name into a new folder 'foo'?

MaSuGaNa
+6  A: 

Try setting the Build Action property of the source DLLs to None. It solved the issue for us.

We have our log4net.dll at root level in the WinForms project. I followed your advice and set the Build Action to "None". Then I added the file as a reference and was able to successfully build and publish the project using ClickOnce.
proudgeekdad