• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1442
  • Last Modified:

C# Application.StartupPath changed by NUnit

I am running tests on my application using NUnit; my application uses the field "Application.StartupPath" to get the current directory of the program.

However, when I run tests using NUnit, the Application.StartupPath is changed to refer to NUnit.exe's start up path. How would I correct this?
0
RishadanPort
Asked:
RishadanPort
  • 2
1 Solution
 
Jaime OlivaresSoftware ArchitectCommented:
Does the startup folder is the same as your .exe file?
If so, you can use ExecutablePath instead.
0
 
RishadanPortAuthor Commented:
It turns out that NUnit creates a copy of the EXE and runs it internally rather then calling the function.
Using the Executable Path, or using Application.StartUp does not work.

I just decided to move all my files I needed to the NUnit directory, and this works fine.
0
 
RishadanPortAuthor Commented:
*calling the function ---> calling routines embedded in the EXE
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now