Search code examples
c#dlldata-access-layerbuildactionoutput-directory

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


I get this warning in a C# project:

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

The project does reference DAL05, which has these values:

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

Also, the project's bin folder contains DAL05.dll with these values:

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

What does it mean that this DLL is considered "incorrectly specified as a file"? Since it's "just" a warning, can I blissfully ignore it, or is this a potential shoal reef?


Solution

  • You should not see the bin folder in the solution explorer, meaning, the bin folder should not be a folder under your project.

    The bin folder is maintained by Visual Studio and the referenced assemblies and referenced project output assemblies are copied there.

    Instead of having a bin folder and the dll files added to this bin folder, you should add a reference to that assembly. The bin folder will automaticaly be created and the referenced assemblies will automatically be copied to the bin folder, or if any of the referenced assemblies is in GAC (Global Assembly Cache), they will be loaded from there.

    1. Add references to assemblies which you currently have in your bin folder

      1.a. If you need to, just create an "extlib" or "dependencies" or a similar folder under your project and copy the dll files there, and reference the assemblies from that folder.

    2. Delete the bin folder from the project
    3. Compile