none
Copy DLLs to working directory for debug? RRS feed

  • Question

  • When we debug our project, we we set the working directory outside of the solution to an area where we have the project's data stored.

    This causes problems when invoking DLLs built by the solution, since they reside back in the $(OutDir) of the startup project.

    I've tried adding $(OutDir) to the Debug settings for the executable, that didn't help.

    I can't find any other form of setting to let me tell it to run $(TargetName).EXE from $(WorkingDirectory) but load DLLs from $(OutDir); and I tried adding a build step that did "copy $(OutDir)\*.dll $(WorkingDirectory), but that didn't work either =/

     

    Saturday, May 14, 2011 11:20 PM

All replies

  • You can either specify the output path of your DLL projects to be in your working directory. Or like you have apparently attempted (not clear how), you can add a Post-Build Event in those projects to copy that DLLs to the working directory. Make sure you have enclosed the paths in quotes if they are in a directory that contains spaces, i.e.
        copy "$(OutDir)\*.dll" "$(WorkingDirectory)"

    - Shoaib.


    Saturday, May 14, 2011 11:41 PM
  • $(WorkingDirectory) isn't expanded as a macro, unfortunately, and while I've worked around it for now by simply hard-coding the path, that breaks as soon as it hits another developer's machine :(

     

    Saturday, May 14, 2011 11:55 PM
  • That's what I was kind of unsure while posting that it doesn't look like a valid VS macro but I assumed you have just referred to some known working directory.

    So what do you expect as the working directory?

    - Shoaib.

    Sunday, May 15, 2011 12:10 AM
  • I am also having debug issues with my DLLs.   All the debug dbs and DLLs are in the same path as the exec but code wont step through.   I have had this issue before but that was ages ago and the problem was the debug files werent in the directory. This time they are far as I can see.    All  did was use the Visual 10 upgrade from 2008 convertor first time i opened.  Program works fine and steps through in 2008 C++
    Sunday, May 15, 2011 6:27 AM