1

Closed

GetEnvironmentVariable throws a null reference exception when the environment variable is not set

description

The title says it all.
 
Shouldn't it return an empty string?
 
Why does it return an array of strings?
Closed Aug 26, 2010 at 9:45 PM by mikeFourie
This library is no longer under active development / support. Please see the home page for details.

comments

mikeFourie wrote Nov 13, 2009 at 11:35 AM

It's a bug in the task. You could use www.msbuildextensionpack.com if you are on .net 3.5 or just plain msbuild (http://blogs.msdn.com/msbuild/archive/2007/05/04/new-registry-syntax-in-msbuild-v3-5.aspx). If you are stuck in 2.0, you could fix the task and recompile the library.

Brumlemann wrote Nov 18, 2009 at 1:36 PM

The same goes for the Registry task. Actually I tried MSBuildExtentionPack to see whether they had it right. Nope.

On a general note. The base task class should (IMHO) have duplicated the ContinueOnError/IgnoreExitCode pair from standard MSBuild tasks. That would greatly enhance the usability. Take this case (and mine). Checking whether you got a real value (as opposed to the null value) with a Condition would be aligned with the de facto task standard.

Brumlemann wrote Nov 18, 2009 at 1:36 PM

The same goes for the Registry task. Actually I tried MSBuildExtentionPack to see whether they had it right. Nope.

On a general note. The base task class should (IMHO) have duplicated the ContinueOnError/IgnoreExitCode pair from standard MSBuild tasks. That would greatly enhance the usability. Take this case (and mine). Checking whether you got a real value (as opposed to the null value) with a Condition would be aligned with the de facto task standard.

Brumlemann wrote Nov 18, 2009 at 1:52 PM

Just remembered this article (http://blogs.msdn.com/msbuild/archive/2007/05/04/new-registry-syntax-in-msbuild-v3-5.aspx) about the new registry syntax and I only ned to read, so never mind ;)

wrote Aug 26, 2010 at 9:45 PM

wrote Feb 14, 2013 at 2:32 AM

wrote May 16, 2013 at 7:00 AM