views:

56

answers:

1

I'm trying to switch from NUnit to MSTest (for the Code Coverage option). We have some of the configuration for the application stored in files (the application finds them by using a relative path, starting from the "bin" folder, where the .dlls are). NUnit worked fine with this configuration. MSTest copies the .dlls in a test folder (TestResults/name/OUT). Is there any way to use MSTest and set it up so it won't copy the .dlls (execute them from the "bin" folder)? I've been searching for this option and it seems to be impossible. Another question (if the copy option is not configurable) how can I find out the starting .dll path (the original file path for the file that gets copied by MSTest in the OUT folder)?

Thanks

A: 

You can use one of the methods in the System.Reflection.Assembly class:

Assembly.GetExecutingAssembly()
Assembly.GetCallingAssembly()
Assembly.GetEntryAssembly()

Between those you should be able to get all you need.

Adam Ruth
I tried this already.GetExecutingAssembly returns the (TestResults/name/OUT) path.GetCallingAssembly returns the Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll pathGetEntryAssembly is Nothing.
Oh, I misread, you want the path where the file was copied from, not where it is now.
Adam Ruth