visual-studio VS2005:程序集“<程序集>”被错误地指定为文件。
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/436471/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
VS2005: Assembly '<assembly>' is incorrectly specified as a file.
提问by Ian Boyd
I've added a reference to the log4net assembly dll to my project.
我已经在我的项目中添加了对 log4net 程序集 dll 的引用。
When I build I get a warning saying:
当我构建时,我收到一条警告说:
Warning Assembly 'Lib\log4net.dll' is incorrectly specified as a file.
警告程序集“Lib\log4net.dll”被错误地指定为文件。
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 isan 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?
如何添加对程序集 dll 的引用,而不添加对程序集 dll 的引用?
回答by
Try setting the Build Action property of the source DLLs to None. It solved the issue for us.
尝试将源 DLL 的 Build Action 属性设置为 None。它为我们解决了这个问题。
回答by jadelane
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.
我添加了一个程序集作为参考和“现有资源”。从解决方案资源管理器中删除文件,关闭,然后重新打开项目工作。

