ToolTask.EnvironmentOverride Vlastnost

Definice

Upozornění

Use EnvironmentVariables property

Získá hodnotu přepsání cesty.Gets the Path override value.

protected:
 virtual property System::Collections::Generic::Dictionary<System::String ^, System::String ^> ^ EnvironmentOverride { System::Collections::Generic::Dictionary<System::String ^, System::String ^> ^ get(); };
protected:
 virtual property System::Collections::Specialized::StringDictionary ^ EnvironmentOverride { System::Collections::Specialized::StringDictionary ^ get(); };
[System.Obsolete("Use EnvironmentVariables property")]
protected virtual System.Collections.Generic.Dictionary<string,string> EnvironmentOverride { get; }
protected virtual System.Collections.Specialized.StringDictionary EnvironmentOverride { get; }
[System.Obsolete("Use EnvironmentVariables property")]
protected virtual System.Collections.Specialized.StringDictionary EnvironmentOverride { get; }
[<System.Obsolete("Use EnvironmentVariables property")>]
member this.EnvironmentOverride : System.Collections.Generic.Dictionary<string, string>
member this.EnvironmentOverride : System.Collections.Specialized.StringDictionary
[<System.Obsolete("Use EnvironmentVariables property")>]
member this.EnvironmentOverride : System.Collections.Specialized.StringDictionary
Protected Overridable ReadOnly Property EnvironmentOverride As Dictionary(Of String, String)
Protected Overridable ReadOnly Property EnvironmentOverride As StringDictionary

Hodnota vlastnosti

Dictionary<String,String>
StringDictionary

Nová hodnota pro prostředí pro úlohu.The new value for the Environment for the task.

Atributy

Příklady

using System;  
using Microsoft.Build.Utilities;  
using System.Collections.Specialized;  

/// <summary>  
/// CustomToolTask overrides the EnvironmentOverride property of ToolTask to add a directory  
/// to the Path environment variable of the process being executed  
/// </summary>  
abstract class CustomToolTask : ToolTask  
{  
      protected override StringDictionary EnvironmentOverride  
      {  
            get  
            {  
                  string newPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Process) + @";C:\MyDirectory";  
                  StringDictionary result = new StringDictionary();  
                  result.Add("Path", newPath);  
                  return result;  
            }  
      }  
}  

Poznámky

Metoda ExecuteTool předá tyto proměnné prostředí do StartInfo procesu, ve kterém se nástroj spouští.The ExecuteTool method passes these environment variables to the StartInfo of the process in which the tool executes. Jakékoli proměnné prostředí, které nejsou součástí slovníku EnvironmentOverride, jsou zděděny z procesu, ve kterém je metoda ExecuteTool spuštěna.Any environment variables not included in the EnvironmentOverride dictionary are inherited from the process in which the ExecuteTool method executes.

Platí pro