diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-06-24 22:30:10 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-06-24 22:30:10 -0700 |
commit | d42868ba3e29c50b47d98995bab376cb2ad1d574 (patch) | |
tree | 54008099ec269a89d69cde7ec4a8d64987557998 /src/DotNetOpenAuth.BuildTasks/SetEnvironmentVariable.cs | |
parent | f34cd5d4c5426c2246286f9df94ba69e428ef481 (diff) | |
download | DotNetOpenAuth-d42868ba3e29c50b47d98995bab376cb2ad1d574.zip DotNetOpenAuth-d42868ba3e29c50b47d98995bab376cb2ad1d574.tar.gz DotNetOpenAuth-d42868ba3e29c50b47d98995bab376cb2ad1d574.tar.bz2 |
Brought back the source code for DNOA.BuildTasks.dll.
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; + } + } +} |