locked
Error loading Test Project dll for C++ test project

    Question

  • Hi Folks,

    I am having trouble with my MSTest project.  I am trying to test my C++ native .libs using a MSTest project.  This worked well initially, but out of the blue it has stopped finding the DLL and all tests with this message: -

    Error loading E:\Workspace\trunk\Sirocco\working\code\SiroccoVS2005\Release\DefaultTest.dll: Could not load file or assembly 'DefaultTest.dll' or one of its dependencies. The specified module could not be found.

    It is the first time I've used MSTest, so I'm not really sure what to try, I've tried some googling, but I couldn't find anything that worked (I tried changing to AnyCPU from Win32)

    Any ideas or workarounds I could try?

    Thanks for your help!
    All the best,
    Ash


    dimanche 4 mars 2012 14:47

Réponses

  • Hi Vicky,

    It was when I built the solution, I couldn't run the tests either.  I found the problem last night before I went to sleep.  I had added a few more tests to the project which depended on the Poco library, therefore I needed to add the Poco dlls in order for the tests to run.

    Could I suggest that VS names the dll it couldn't find as it would make life a little easier for devs.  I managed to find what dll it was looking for by loading DefaultTest.dll into dependency walker ( http://www.dependencywalker.com/ ), I hope this helps other devs.

    Thanks for your help, sorry I didn't reply last night,
    All the best,
    Ash

    PS. I think I used that guide (native tests) previously when setting up the project, it was really useful.

    • Marqué comme réponse Ash McC lundi 5 mars 2012 08:26
    lundi 5 mars 2012 08:26

Toutes les réponses

  • Hello Ash,

    When did you get the "Could not load file or assembly" error message you offered above? When you run the tests or when you build solution?

    In addition, please also make sure that you have setup or created test project correctly in order to create unit tests for native C++. You need to write the unit tests in C++ or CLI, and then configure the Change the Common Language RunTime Support property of test project to be Common Language RunTime Support (/clr).

    Please take a look at this blog for further information about how to create unit tests for native C++:

    http://blogs.msdn.com/b/jsocha/archive/2010/11/19/writing-unit-tests-in-visual-studio-for-native-c.aspx 

    Thanks.


    Vicky Song [MSFT]
    MSDN Community Support | Feedback to us

    lundi 5 mars 2012 07:22
  • Hi Vicky,

    It was when I built the solution, I couldn't run the tests either.  I found the problem last night before I went to sleep.  I had added a few more tests to the project which depended on the Poco library, therefore I needed to add the Poco dlls in order for the tests to run.

    Could I suggest that VS names the dll it couldn't find as it would make life a little easier for devs.  I managed to find what dll it was looking for by loading DefaultTest.dll into dependency walker ( http://www.dependencywalker.com/ ), I hope this helps other devs.

    Thanks for your help, sorry I didn't reply last night,
    All the best,
    Ash

    PS. I think I used that guide (native tests) previously when setting up the project, it was really useful.

    • Marqué comme réponse Ash McC lundi 5 mars 2012 08:26
    lundi 5 mars 2012 08:26