How to deploy additional dlls? RRS feed

  • Question

  • Hello,

    I am writing Unit Tests in VC 2008 Professional for C# and stumbled upon an issue I don't know how to fix.

    The assembly which is tested is added as reference in the testing project, when running tests, this assembly is copied to the generated test directory (the one with the user id and timestamp)

    Unfortunately all of my tests fail since the used assembly requires a large set of additional files to work properly (bunch of unmanaged dlls and so on)

    Since I do not know in advance, how the directory will be named, I cannot create a post build event to handle that.

    I tried adding the files to the project (not as reference), but this copies the files first into the source directory, which I dont want, since they are build when the parent assembly is build and setting these files to Copy always (Copy to Output Directory) does not work, they are not copied into the test target directory.

    Then I found DeploymentItem http://msdn.microsoft.com/en-us/library/ms182475%28VS.80%29.aspx

    But this fails for me, since it requires to be used as per method attribute and having 100 Methods with 10 DeploymentItems deploying always something because you cannot guarantee the order of those tests is quite cumbersome. And ordered tests are quite unhandy to do.

    Is there any other way that would to the trick?





    Wednesday, November 3, 2010 12:14 PM


  • Edit your testsettings file (usually Local.testsettings), enable deployment, and add the assemblies that are required.
    • Marked as answer by Vinculum Wednesday, November 3, 2010 2:30 PM
    Wednesday, November 3, 2010 12:51 PM