Ask a questionAsk a question
 

QuestionNon-assembly dependency management

  • Thursday, November 05, 2009 9:54 AMJan Svab Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I'd like to know what is the preferred way of adding unmanaged DLLs into Visual Studio build chain. How can I add a reference to an unmanaged DLL, so that it gets copied to project target directory when building?
    Example: in my solution, I have a third party unmanaged library A.dll, which is wrapped into my managed wrapper B.dll. This is used by a library C.dll which is used by application D.exe. So in my solution I have three projects B, C, D and one file A.dll. How can I set up the build process so that A.dll gets copied to output folder of application D when D is built?

    In my current setup (probably not the "right" one) I have A.dll as a data file of project B, with "build action" set to "none" and "copy to output directory" set to "copy always". Then project reference to B is added to project C and project C is referenced in D. (Note that direct reference to B is not added to D, because D doesn't use classes in B, it uses just classes in C.)
    Unfortunately, this doesn't work. When building project B, the file A.dll is copied to output directory correctly. When building C, the B.dll and A.dll are also copied correctly to output directory of C. However, when building D, all the managed assemblies B.dll, C.dll and D.exe are in output directory, but the file A.dll is not copied. Seems that although the references themselves are propagating to more than one-level referencing, the files added to projects with "copy always" flag are non-propagating.

    Do I get something wrong? Or is there a better way how to set up the projects for this scenario?

    • Moved byChao KuoMSFTMonday, November 09, 2009 2:29 AMOff topic in vsx (From:Visual Studio Source Control and SourceSafe)
    •  

All Replies

  • Thursday, November 05, 2009 9:56 AMJan Svab Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello,

    please post threads in a proper forum. Basically, it is off-topic here.

    Best regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!

    Hello, thanks for reply. Could you recommend better forum? This was the best matching topic I found. If you don't think so, please tell me what is the proper one? Installation? Or Crystal reports? Please feel free to move question to better forum. If you don't know better forum, then it's probably really the best matching topic and moving my question to "Off topic" provides no help.