當前位置: 首頁>>代碼示例>>C#>>正文


C# TargetRuntime.GetToolsEnvironmentVariables方法代碼示例

本文整理匯總了C#中MonoDevelop.Core.Assemblies.TargetRuntime.GetToolsEnvironmentVariables方法的典型用法代碼示例。如果您正苦於以下問題:C# TargetRuntime.GetToolsEnvironmentVariables方法的具體用法?C# TargetRuntime.GetToolsEnvironmentVariables怎麽用?C# TargetRuntime.GetToolsEnvironmentVariables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MonoDevelop.Core.Assemblies.TargetRuntime的用法示例。


在下文中一共展示了TargetRuntime.GetToolsEnvironmentVariables方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetProjectBuilder

		public static RemoteProjectBuilder GetProjectBuilder (TargetRuntime runtime, TargetFramework fx, string file)
		{
			lock (builders) {
				string binDir = runtime.GetMSBuildBinPath (fx);
				
				RemoteBuildEngine builder;
				if (builders.TryGetValue (runtime, out builder)) {
					builder.ReferenceCount++;
					return new RemoteProjectBuilder (file, binDir, builder);
				}
				
				if (runtime.IsRunning) {
					if (currentBuildEngine == null)
						currentBuildEngine = new RemoteBuildEngine (null, new BuildEngine ());
					return new RemoteProjectBuilder (file, binDir, currentBuildEngine);
				}
				else {
					MonoDevelop.Core.Execution.RemotingService.RegisterRemotingChannel ();
					string exe = typeof(ProjectBuilder).Assembly.Location;
					ProcessStartInfo pinfo = new ProcessStartInfo (exe);
					foreach (KeyValuePair<string,string> evar in runtime.GetToolsEnvironmentVariables (fx))
						pinfo.EnvironmentVariables [evar.Key] = evar.Value;
					pinfo.UseShellExecute = false;
					pinfo.RedirectStandardError = true;
					pinfo.RedirectStandardInput = true;
					
					Process p = null;
					try {
						p = runtime.ExecuteAssembly (pinfo, fx);
						p.StandardInput.WriteLine (Process.GetCurrentProcess ().Id.ToString ());
						string sref = p.StandardError.ReadLine ();
						byte[] data = Convert.FromBase64String (sref);
						MemoryStream ms = new MemoryStream (data);
						BinaryFormatter bf = new BinaryFormatter ();
						builder = new RemoteBuildEngine (p, (IBuildEngine) bf.Deserialize (ms));
					} catch {
						if (p != null) {
							try {
								p.Kill ();
							} catch { }
						}
						throw;
					}
				}
				builders [runtime] = builder;
				builder.ReferenceCount = 1;
				return new RemoteProjectBuilder (file, binDir, builder);
			}
		}
開發者ID:transformersprimeabcxyz,項目名稱:monodevelop-1,代碼行數:49,代碼來源:MSBuildProjectService.cs


注:本文中的MonoDevelop.Core.Assemblies.TargetRuntime.GetToolsEnvironmentVariables方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。