summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.BuildTasks/SetEnvironmentVariable.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-08-07 14:15:32 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2010-08-07 14:15:32 -0700
commitd40bbbd127eb1a833e06af14f7dc352e272e2c43 (patch)
tree6a46408dcc909d31ac1f0230ce2fba4eeb4ae74a /src/DotNetOpenAuth.BuildTasks/SetEnvironmentVariable.cs
parent9940f1a22a8a322a19d1036ab9660f7dd62ddcc1 (diff)
parentb10e1c35117832121a5ea1042f812db2fafb8a9d (diff)
downloadDotNetOpenAuth-d40bbbd127eb1a833e06af14f7dc352e272e2c43.zip
DotNetOpenAuth-d40bbbd127eb1a833e06af14f7dc352e272e2c43.tar.gz
DotNetOpenAuth-d40bbbd127eb1a833e06af14f7dc352e272e2c43.tar.bz2
Merge branch 'v3.0' into v3.1
Diffstat (limited to 'src/DotNetOpenAuth.BuildTasks/SetEnvironmentVariable.cs')
-rw-r--r--src/DotNetOpenAuth.BuildTasks/SetEnvironmentVariable.cs33
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;
+ }
+ }
+}