1

Closed

Property values with '=' give an error

description

First off, great msbuild extension.... possibly the only one I'll ever need.
 
Example: Arguments="foo=1+1=2;bar=2*2=4" fails with Argument exception. Also, the ArgumentException text isn't formatted.
 
Suggest changing FillNamedArguments implementation to:
    private void FillNamedArguments(Runspace runspace)
    {
        if ( this.Arguments != null )
        {
            foreach ( string argument in Arguments )
            {
                int splitIdx = argument.IndexOf('=');
                if ( splitIdx <= 0 )
                {
                    throw new ArgumentException( String.Format("Invalid syntax for argument: {0}\r\nUse \"varname=value\"", argument) );
                }
 
                string name = argument.Substring(0,splitIdx);
                string value = argument.Substring(splitIdx+1);
 
                runspace.SessionStateProxy.SetVariable( name, value );
            }
        }
    }
Closed Jul 24, 2009 at 10:57 PM by ArildFines
Fixed based on your code in http://powershellmsbuild.codeplex.com/SourceControl/changeset/view/26247

comments