public void RestoreCapturesArgumentsToForwardToMSBuildWhenTargetIsSpecified() { var result = Parser.Instance.Parse(@"dotnet restore .\some.csproj --packages c:\.nuget\packages /p:SkipInvalidConfigurations=true"); result.ValueForArgument <IEnumerable <string> >(RestoreCommandParser.SlnOrProjectArgument).Should().BeEquivalentTo(@".\some.csproj"); result.OptionValuesToBeForwarded(RestoreCommandParser.GetCommand()).Should().Contain(@"-property:SkipInvalidConfigurations=true"); }
public static RestoreCommand FromArgs(string[] args, string msbuildPath = null, bool noLogo = true) { DebugHelper.HandleDebugSwitch(ref args); var parser = Parser.Instance; var result = parser.ParseFrom("dotnet restore", args); result.ShowHelpOrErrorIfAppropriate(); var msbuildArgs = new List <string>(); if (noLogo) { msbuildArgs.Add("-nologo"); } msbuildArgs.Add("-target:Restore"); msbuildArgs.AddRange(result.OptionValuesToBeForwarded(RestoreCommandParser.GetCommand())); msbuildArgs.AddRange(result.ValueForArgument <string[]>(RestoreCommandParser.SlnOrProjectArgument) ?? Array.Empty <string>()); return(new RestoreCommand(msbuildArgs, msbuildPath)); }
public static RestoreCommand FromParseResult(ParseResult result, string msbuildPath = null, bool noLogo = true) { result.HandleDebugSwitch(); result.ShowHelpOrErrorIfAppropriate(); var msbuildArgs = new List <string>(); if (noLogo) { msbuildArgs.Add("-nologo"); } msbuildArgs.Add("-target:Restore"); msbuildArgs.AddRange(result.OptionValuesToBeForwarded(RestoreCommandParser.GetCommand())); msbuildArgs.AddRange(result.GetValueForArgument(RestoreCommandParser.SlnOrProjectArgument) ?? Array.Empty <string>()); return(new RestoreCommand(msbuildArgs, msbuildPath)); }
public void RestoreCapturesArgumentsToForwardToMSBuildWhenTargetIsNotSpecified() { var result = Parser.Instance.Parse(@"dotnet restore --packages c:\.nuget\packages /p:SkipInvalidConfigurations=true"); result.OptionValuesToBeForwarded(RestoreCommandParser.GetCommand()).Should().Contain(@"-property:SkipInvalidConfigurations=true"); }