2

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

user249380
  • 21
  • 2

2 Answers2

0

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
  • 3,575
  • 1
  • 21
  • 20
  • I tried this already. GetExecutingAssembly returns the (TestResults/name/OUT) path. GetCallingAssembly returns the Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll path GetEntryAssembly is Nothing. – user249380 Jan 13 '10 at 00:50
  • Oh, I misread, you want the path where the file was copied from, not where it is now. – Adam Ruth Jan 13 '10 at 22:28
-1

You can also use TestContext. See http://msdn.microsoft.com/en-us/library/ms404699.aspx.

Shital Shah
  • 63,284
  • 17
  • 238
  • 185