diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-08-07 14:38:54 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-08-07 14:38:54 -0700 |
commit | e7ce41355c38b3125729a62920231f274b7a2100 (patch) | |
tree | 5f72a002a9b839e8fbcb694dfafee533a0e644f6 /src/DotNetOpenAuth.BuildTasks/SetEnvironmentVariable.cs | |
parent | a000d147d61fb0335983a43e9f930f7a1ca60104 (diff) | |
parent | 23499563a7773abc203dae9d96c1c0b84897159b (diff) | |
download | DotNetOpenAuth-e7ce41355c38b3125729a62920231f274b7a2100.zip DotNetOpenAuth-e7ce41355c38b3125729a62920231f274b7a2100.tar.gz DotNetOpenAuth-e7ce41355c38b3125729a62920231f274b7a2100.tar.bz2 |
Merge branch 'v3.1' into v3.2origin/v3.2
Diffstat (limited to 'src/DotNetOpenAuth.BuildTasks/SetEnvironmentVariable.cs')
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/SetEnvironmentVariable.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/SetEnvironmentVariable.cs b/src/DotNetOpenAuth.BuildTasks/SetEnvironmentVariable.cs new file mode 100644 index 0000000..2de5976 --- /dev/null +++ b/src/DotNetOpenAuth.BuildTasks/SetEnvironmentVariable.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Microsoft.Build.Utilities; +using Microsoft.Build.Framework; + +namespace DotNetOpenAuth.BuildTasks { + public class SetEnvironmentVariable : Task { + public SetEnvironmentVariable() { + Scope = EnvironmentVariableTarget.Process; + } + + /// <summary> + /// The name of the environment variable to set or clear. + /// </summary> + [Required] + public string Name { get; set; } + /// <summary> + /// The value of the environment variable, or the empty string to clear it. + /// </summary> + [Required] + public string Value { get; set; } + /// <summary> + /// The target environment for the variable. Machine, User, or Process. + /// </summary> + public EnvironmentVariableTarget Scope { get; set; } + + public override bool Execute() { + Environment.SetEnvironmentVariable(Name, Value, Scope); + return true; + } + } +} |