在我的 C# 项目中将 DLL 标记为 "incorrectly specified as a file" 是什么意思?

What does it mean that a DLL is flagged as "incorrectly specified as a file" in my C# project?

我在 C# 项目中收到此警告:

Assembly 'bin\DAL05.dll' is incorrectly specified as a file.

该项目确实引用了 DAL05,它具有以下值:

Description = "Data Access Layer for VS2005"
Version = v2.0.50727

此外,项目的 bin 文件夹包含 DAL05.dll,这些值为:

BuildAction = "Content"
Copy to Output Directory = "Do not copy"
Full Path = "C:\Projects\PRP\PlatypusReportingPackage\bin\DAL05.dll"

此 DLL 被视为 "incorrectly specified as a file" 是什么意思?既然是"just"一个警告,我可以无视它吗,还是这是一个潜在的暗礁?

您应该在解决方案资源管理器中看不到 bin 文件夹,也就是说,bin 文件夹不应该是您项目下的文件夹。

bin 文件夹由 Visual Studio 维护,引用的程序集和引用的项目输出程序集被复制到那里。

您不应将 bin 文件夹和 dll 文件添加到该 bin 文件夹,而应添加对该程序集的引用。 bin 文件夹将自动创建,引用的程序集将自动复制到 bin 文件夹,或者如果任何引用的程序集在 GAC(全局程序集缓存)中,它们将从那里加载。

  1. 添加对您当前在 bin 文件夹中的程序集的引用

    1.a。如果需要,只需在项目下创建一个 "extlib" 或 "dependencies" 或类似的文件夹,然后将 dll 文件复制到那里,然后引用该文件夹中的程序集。

  2. 从项目中删除bin文件夹
  3. 编译