DLL not being copied to output directory


  • Hello-


    I'm running into a strange problem. I have a class library project called DataAccess.MySQL. It implements a MySQL version of my DAL interfaces and holds the NHibernate mapping files. The project references both th NHibernate DLLs and MySQL.Data DLLs using file references. Both references are identical (aliases = global, copy local = true, specific version = false). When the project builds, both of the referenced DLLs show up in the output directory (bin/Debug). This works as I would expect.


    The problem is that when I set up a project reference to DataAccess.MySQL (e.g., from my test project DataAccess.MySQL.Tests), every DLL associated with the DataAccess.MySQL project gets copied into the output directory except the MySQL.Data DLL. I get the DataAccess.MySQL dll, the NHibernate DLL, and a bunch of assemblies that NHibernate depends upon (log4net, etc). I can't figure out why the MySQL.Data DLL isn't being copied.


    Does anyone know what might be going on? Thanks.



    Wednesday, August 29, 2007 1:23 AM

All replies

  • Try looking at the diagnostic log, maybe, for a clue. To set verbosity in VS, look at the "how to report bug" posting at the top of the forum.



    Wednesday, August 29, 2007 5:16 PM
  • Dan-


    I generated the diagnostic output. There's a lot of information in there, but from what I can tell, the MySql.Data.dll assembly is not making it into the list of assembly references during the ResolveAssemblyReference task. All of my other DLLs are, however.


    I did notice that the references were set up slightly differently in the csproj file of the project I'm referencing (my DataAccess.MySQL project). Here's a snippet:


        <Reference Include="MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
          <HintPath>..\ThirdParty\MySQL Connector Net\Current\Binaries\.NET 2.0\MySql.Data.dll</HintPath>
        <Reference Include="NHibernate, Version=, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
        <Reference Include="System" />
        <Reference Include="System.Data" />
        <Reference Include="System.Xml" />


    You can see that the MySql.Data assembly has the element "<Private>true</Private>". If I manually edit the csproj file to remove that element, the situation remains unchanged, however.


    Lastly, I inspected the assembly manifest of the DataAccess.MySQL assembly to see if there was any reason the MySql.Data dll would not be picked up as a dependent assembly. Interestingly, the MySql.Data dll does not show up in the manifest. Here are all of the extern blocks, as reported my ildasm:


    .assembly extern mscorlib
      .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
      .ver 2:0:0:0
    .assembly extern DomainModel
      .ver 1:0:0:0
    .assembly extern NHibernate
      .publickeytoken = (AA 95 F2 07 79 8D FD B4 )                         // ....y...
      .ver 1:2:0:4000
    .assembly extern System.Data
      .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
      .ver 2:0:0:0


    The DomainModel assembly represents my domain objects.


    So, it looks like the root problem is that the MySql.Data assembly isn't being added as a dependent assembly to the DataAccess.MySQL assembly. The only snag here is I'm not sure how to troubleshoot that. Any ideas on why a referenced assembly would not be added as a dependent assembly to the manifest?


    Thanks for your help.



    Wednesday, August 29, 2007 9:07 PM
  • I created a minimal VS.NET solution that recreates this problem. I posted it at:



    Any ideas?

    Saturday, September 01, 2007 12:57 AM
  • This still isn't working for me. Has anyone been able to recreate the issue?

    Monday, September 03, 2007 8:16 PM
  • AFAIK, if a referenced assembly isn't used it isn't added as a dependency in the manifest.


    Is the assembly in question used directly or just via some reflection magic?


    Tuesday, September 04, 2007 7:59 AM
  • I am experiencing a similar problem.  All but one of the NHibernate related DLLs are being copied.



    Not Coppied:


    Any resolution?

    Tuesday, January 13, 2009 5:38 AM