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 9143901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:08:16+00:00 2026-06-17T10:08:16+00:00

Here is my unit test code: [TestMethod] public void GetMyAttachmentTest() { var files =

  • 0

Here is my unit test code:

[TestMethod]
public void GetMyAttachmentTest()
{
    var files = Directory.GetFiles(
        Directory.GetCurrentDirectory() + "/Common/MyFiles/", "*.*");

     .... do some thing with the files...
}

On TFS build machine, when I run my unit test, I am getting the following error:

System.IO.DirectoryNotFoundException: Could not find a part of the path 
'C:\Builds\4\30 my folder v1.0\myfolder1\TestResults\SCMTFSService_MyBuildServer 2013-01-16 18_06_52_Any CPU_Release\Out\Common\MySpecialFiles\'.

When I look into the drop folder in TFS, I see that my files are deployed into the following folder:

\\MyBuildServer\Builds\MyFolder\MySolution_20130116.5\Common\MySpecialFiles

Inside my unit test code, I get my files as follows:

var files = Directory.GetFiles(
    Directory.GetCurrentDirectory() + "/Common/MySpecialFiles/", "*.*");

Is there a way when my unit test runs on TFS build machine that it can look into the files in the deployed Common\MySpecialFiles?

  • 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-06-17T10:08:17+00:00Added an answer on June 17, 2026 at 10:08 am

    The question is a bit vague. In the past, I’ve had issues with unit tests executing in temp locations. This can be problematic with dynamic paths such as GetCurrentDirectory(). When the the temp directory changes/clears, files can be “lost”.

    Instead of using a dynamic path, setup a network share with appropriate permissions. I recommend storing the path to this network share a config file or the DB so that it can be updated without a code push.

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

Sidebar

Related Questions

How do I unit test a custom ModelBinder? Here's the code. public class MagicBinder
I'm wring a unit test for a controller and here is my code. public
I have a class defined by an interface public interface Test { void testMethod();
I try to test my controller [TestMethod] public void Index() { AdminController controller =
I have a simple unit test case (extensive question here ) on a configuration
I am trying to write a unit test to cover code found in our
The code in question public void StartPlaying() { ThreadPool.QueueUserWorkItem(ignoredState => { while (_playlist.Count >
I want to test the following method in C# for all code paths. public
Can I make ServiceStack Deserialize json value of 1 as true? Here's a unit
Our unit tests failures are not being reported by Jenkins. Here's what we see

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.