Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6189933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:29:52+00:00 2026-05-24T02:29:52+00:00

I have a number of test classes and methods that copy a particular directory

  • 0

I have a number of test classes and methods that copy a particular directory like so:

[TestClass, DeploymentItem("LanguageData", "LanguageData")]
public class OcrTests
{
    [TestMethod]
    public void Can_Capture_Field()
    {
        // some code that expects the LanguageData directory to be in the test results Out directory
    }

    // etc
}

[TestClass]
public class OcrBuilderTests
{
    [TestMethod, DeploymentItem("LanguageData", "LanguageData")]
    public void Can_Build_Specific_Ocr_Engine_Implementation()
    {
        // some more code that expects the LanguageData directory to be in the test results Out directory
    }

    // etc
}

Those tests are in a single assembly and all the files in the LangaugeData directory have their Copy to Output Directory set to Copy Always.

It all works fine and the directory is copied to the test results Out directory as long as I only have that one test assembly loaded into the solution or that’s the only assembly I run tests from (i.e. run tests only in current context/class).

As soon as I add a second assembly and run all the tests in the solution then that directory no longer gets copied, but any other DeploymentItems that are just individual files seem to get copied fine.

The tests themselves all still run, but the ones that depend on that directory crash. Presumably that’s because MSTest can’t find the directory – perhaps it’s expecting it to be in the build directory of one of the other test assemblies?

Any ideas what it is about multiple test projects that’s preventing the copy, and what I can do to get around it, short of adding every single file in that directory as an individual DeploymentItem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:29:54+00:00Added an answer on May 24, 2026 at 2:29 am

    This question is quite old, but could still benefit others. Especially since I ended up here 🙂

    It seems that DeploymentItemAttribute doesn’t support using the same source path name in multiple test classes.
    Note: I said same path name, not physical folder (think different test projects with same folder name to deploy).

    However the destination folder name can be different, with no ill effects.

    My suggestion is:

    1. Create a fixture base class (if you prefer, in separate project)
    2. Add the attribute: [TestClass, DeploymentItem("LanguageData", "LanguageData")]
    3. Change your OcrTests and OcrBuilderTests classes to inherit the new class.
    4. Remember to remove the deploymentitem attributes for ‘LanguageData’ from OcrTests and OcrBuilderTests

    I’ve tried this, with Great Success.
    In my case, I had a common test fixture project and multiple test projects, each using the base class.

    Unfortunately the DeploymentItemAttribute is filled with Gotchas, see here for more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a domain class that looks like this: class Offerbyuser { Number offerPrice
I have some written a number of unit tests that test a wrapper around
I have a WPF dll that contains a number of Window classes and exposes
I have some classes in the lib directory, and I want to test it.
How can I enforce that my test class covers a particular interface? Also is
I am using Grails 1.3.7, and have the following domain classes: package com.fxpal.test class
I have a number of data classes representing various entities. Which is better: writing
I have a number of code value tables that contain a code and a
I have a number of tables that use the trigger/sequence column to simulate auto_increment
I have a number of methods in C# which return various collections which I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.