2009-04-17 Marek Habersack <mhabersack@novell.com>
[mono.git] / mcs / class / System / Microsoft.CSharp / CSharpCodeCompiler.cs
index 91d9bc787f69b050d31e4f123fa90a06c7711c1f..896c452b968c91957512c556b60b178eb7d3eb88 100644 (file)
@@ -216,6 +216,22 @@ namespace Mono.CSharp
                        mcsOutput = new StringCollection ();
                        mcsOutMutex = new Mutex ();
 #endif
+
+                       string monoPath = Environment.GetEnvironmentVariable ("MONO_PATH");
+                       if (monoPath == null)
+                               monoPath = String.Empty;
+                       
+                       string privateBinPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
+                       if (privateBinPath != null && privateBinPath.Length > 0)
+                               monoPath = String.Format ("{0}:{1}", privateBinPath, monoPath);
+
+                       if (monoPath.Length > 0) {
+                               StringDictionary dict = mcs.StartInfo.EnvironmentVariables;
+                               if (dict.ContainsKey ("MONO_PATH"))
+                                       dict ["MONO_PATH"] = monoPath;
+                               else
+                                       dict.Add ("MONO_PATH", monoPath);
+                       }
                        
                        mcs.StartInfo.CreateNoWindow=true;
                        mcs.StartInfo.UseShellExecute=false;
@@ -321,6 +337,10 @@ namespace Mono.CSharp
                        else
                                args.Append("/target:library ");
 
+                       string privateBinPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
+                       if (privateBinPath != null && privateBinPath.Length > 0)
+                               args.AppendFormat ("/lib:\"{0}\" ", privateBinPath);
+                       
                        if (options.Win32Resource != null)
                                args.AppendFormat("/win32res:\"{0}\" ",
                                        options.Win32Resource);