예제 #1
0
        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");
        }
예제 #2
0
        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));
        }
예제 #3
0
파일: Program.cs 프로젝트: vitek-karas/sdk
        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));
        }
예제 #4
0
        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");
        }