I am trying to run automated tests on a particular product. The test consists of installing the product into different locations on the hard drive and then performing some operations on it and then closing the application.
The code that launches the process looks like this:
using (Process process = new Process())
{
process.StartInfo.FileName = "C:\mylocation\myapp.exe";
process.Start();
}
While executing the tests continuously, when the install location of the application changes, I get an exception from the above code that says:
API restriction: The assembly 'file:///C:\alternate_location\myapp.exe' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.
The tests cannot be run continuously because of this.
What can be done to overcome this? Is there anyway I can unload assemblies form the GAC?
Can I do something in my test application to overcome this OR does something have to be changed in the application that I am testing?