UnitTestRunner.exe directories

Why does UnitTestRunner make copies of all the assemblies into a complex
temp directory structure underneath /Documents and Settings/username and
run from there instead of just running from the actual project output
folder? I'm trying to do some runtime reflection to get at some files
near my source code files, and it would work except for this weird move
by UnitTestRunner.

I'm trying code like:

string directory =
Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly((myInstance).GetType()).Location);

and it's thrown off bigtime because of the assemblies being moved.

Argh this is frustrating.

5 comments
Comment actions Permalink

That is default "shadow copy" directory

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Chris Morris" <chris.morris@einstruction.com> wrote in message
news:ekfr07$kld$1@is.intellij.net...

Why does UnitTestRunner make copies of all the assemblies into a complex
temp directory structure underneath /Documents and Settings/username and
run from there instead of just running from the actual project output
folder? I'm trying to do some runtime reflection to get at some files near
my source code files, and it would work except for this weird move by
UnitTestRunner.

>

I'm trying code like:

>

string directory =
Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly((myInstance).GetType()).Location);

>

and it's thrown off bigtime because of the assemblies being moved.

>

Argh this is frustrating.



0
Comment actions Permalink

Eugene Pasynkov (JetBrains) wrote:

That is default "shadow copy" directory


Why is it done that way? Is there an option to not do this? Are there
side effects I'm unaware of with just running with the assemblies in the
default build output folders?

0
Comment actions Permalink

Hello Chris,

one sich side effect is that the output assemblies will be locked and couldn't
be overwritten during test run which is not always something that you want.

Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


Eugene Pasynkov (JetBrains) wrote:

>> That is default "shadow copy" directory
>>

Why is it done that way? Is there an option to not do this? Are there
side effects I'm unaware of with just running with the assemblies in
the default build output folders?



0
Comment actions Permalink

Don't the Team System test runner, the TestDriven.NET test runner, and the
NUnit test runner work with shadow copies too? This issue of file contention
is not unique to UnitRunner. One just has to ensure the other files are copied
to the same directory.


0
Comment actions Permalink

Dmitry Shaporenkov wrote:

Hello Chris,

one sich side effect is that the output assemblies will be locked and
couldn't be overwritten during test run which is not always something
that you want.



Apparently (unless I missed this option with 2.0) you guys decided to
put in an option for this ... there's now (2.5) a checkbox in the Unit
Testing options to turn off the shadow copy. Cool.

I didn't see this listed here:
http://www.jetbrains.com/resharper/features/newfeatures.html?rs25nl --
but maybe that was too small to mention.

Anyway - nice to stumble across this, would've been nice to know it was
added ahead of time in case I didn't stumble across it for sometime.

0

Please sign in to leave a comment.