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

  • Home
  • SEARCH
  • 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 3802374
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:11:55+00:00 2026-05-19T14:11:55+00:00

I have a test project in a Visual Studio 2010 solution, which tests another

  • 0

I have a test project in a Visual Studio 2010 solution, which tests another project that is an FTP utility. The test project needs to FTP files here and there, so I use a test file to pass to the utilities methods and verify it gets uploaded/archived/etc. In my test project I have a folder under the root of it called TestFiles, with a single .txt file in it. I want to have it to where whenever someone checks out the solution from source control and runs the unit tests, that the file in that folder is grabbed and used in the FTP unit tests.

I’ve tried using this, and variations in the post-build event command line, but with no luck:

copy $(ProjectDir)TestFiles\Test.txt $(ProjectDir)Debug\bin\Test.txt

All I really want to do is make sure that I can use a relative path for any local test files, so that I am guaranteed not to have problems no matter where someone on my team checks the project out to (or if Team Foundation Server runs an automated build and fires the unit tests for my project).

I’m currently trying to access the file in my unit tests like this, so that I just grab it from the debug area:

ftp.uploadThisFileSomewhere(
AppDomain.CurrentDomain.BaseDirectory + "\\TestFiles\\Test.txt");

So, is this the proper way to grab a test file? I don’t think it is, but I can’t seem to find a good best practices doc on it. If it’s good enough, how do you copy/guarantee a relative location no matter where the project is built/run?

  • 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-19T14:11:56+00:00Added an answer on May 19, 2026 at 2:11 pm

    The suggested practice is to use DeploymentItem Attribute for each item that needs to be autocopied during the MSTest process.

    There’s a number of steps to follow, from defining the items, to making sure each file has the correct properties, blah blah blah. So, I wrote a nice lit of instructions about how to do this.

    Have a read of a detailed description about how to do this.

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

Sidebar

Related Questions

For some reason, my visual studio 2008 installation doesn't have the Create Test Project
I need to get VS 2010 projects that are using Visual Studio Tests building
I have this Visual Studio 2010 Setup Project for installing my application. On (clean)
I am fairly new to development, and Visual Studio 2010. I have a solution
I am writing unit tests in visual studio 2010. For test some functionality, I
I have a Visual Studio 2010 MVC 3 web solution containing a number of
I have a solution in Visual Studio 2010 containing 6 projects (1 web application,
Hi, I have done the following : Start Visual Studio 2010 New Project >
I have a ui coded ui test in visual studio 2010. I want to
I have a ui coded ui test in visual studio 2010. I want to

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.