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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:34:54+00:00 2026-06-08T08:34:54+00:00

I’m using C# 4.0. I’m running a unit test using Microsoft.VisualStudio.TestTools.UnitTesting . My UnitTest

  • 0

I’m using C# 4.0.

I’m running a unit test using Microsoft.VisualStudio.TestTools.UnitTesting.

My UnitTest project tests another project, say ProjectA. ProjectA creates a process like this:

Process mplex = new Process();
psi = new ProcessStartInfo();
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
psi.RedirectStandardError = true;
psi.FileName = "cmd.exe";
psi.Arguments = "/C mplex omittedForBrevity";
mplex.StartInfo = psi;
mplex.Start();

/* This is telling me: "'mplex' is not recognized 
 * as an internal or external command, operable 
 * program or batch file." */
var a = mplex.StandardError.ReadToEnd();

I’ve placed “MPLex.exe” inside various bin’s, including the “AppDomain.CurrentDomain.BaseDirectory” (which is the \bin\Debug\ folder for my UnitTest project).

MPLex.exe is basically Microsoft’s derivative of GPLEX, which is a C# version of Flex/Lex. When I add a reference to MPLex.exe it in ProjectA and view it in the Object browser I don’t see any methods that look like Main, or public ways of interfacing with it, otherwise I would do that instead of calling it via cmd as I’ve done above.

I think what’s going on is when it’s being unit tested, it’s not searching the \bin\Debug\ directory. When I run the same code in ProjectA from a Main method in a non-unit-test ProjectB, it works fine. If I could somehow strongly reference the .exe so that it’d get copied everywhere it’s needed, then I think my issue would be solved. How can I do this?

EDIT:

Adding this fixed it, but for all I know I may have just broke something else that hasn’t made itself known, yet.

System.IO.Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
  • 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-08T08:34:55+00:00Added an answer on June 8, 2026 at 8:34 am

    mstest does not run your unit tests in place out of bin. It copies the tests and referenced assemblies to a test deployment folder, typically under TestResults in the solution directory. I’ve “unit” tested similar components and always need to use the deployment features, which are a headache to use for something so simple, but here goes.

    First, your testsettings must have deployment enabled. Go to the testsettings file and select the deployment tab and click enable deployment. Depending on how your solution is structured, you can add the mplex file here. In our project, I don’t do that because the necessary files are often outside the source control tree for the tests and VS will complain, if this is the case use the file links I describe below.

    You can also add a DeploymentItem attribute to specific tests or test classes and the file will only be copied if those tests are run. This is helpful if it is a large data file that you don’t want copied all the time.

    If the necessary files are outside the test solution, add the necessary file(s) as links in the test project and set the build action to copy always. Then either add to the deployed files in the testsettings or use the DeploymentItem attribute.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.