+ mcs.StartInfo.Arguments=BuildArgs(options, fileNames, ProviderOptions);
+ }
+
+ mcsOutput = new StringCollection ();
+ mcsOutMutex = new Mutex ();
+#if !NET_4_0
+ /*
+ * !:. KLUDGE WARNING .:!
+ *
+ * When running the 2.0 test suite some assemblies will invoke mcs via
+ * CodeDOM and the new mcs process will find the MONO_PATH variable in its
+ * environment pointing to the net_2_0 library which will cause the runtime
+ * to attempt to load the 2.0 corlib into 4.0 process and thus mcs will
+ * fail. At the same time, we must not touch MONO_PATH when running outside
+ * the test suite, thus the kludge.
+ *
+ * !:. KLUDGE WARNING .:!
+ */
+ if (Environment.GetEnvironmentVariable ("MONO_TESTS_IN_PROGRESS") != null) {
+ string monoPath = Environment.GetEnvironmentVariable ("MONO_PATH");
+ if (!String.IsNullOrEmpty (monoPath)) {
+ monoPath = monoPath.Replace ("/class/lib/net_2_0", "/class/lib/net_4_0");
+ mcs.StartInfo.EnvironmentVariables ["MONO_PATH"] = monoPath;
+ }
+ }