当前位置: 首页>>代码示例>>C#>>正文


C# CommandLineBuilderExtension.ToString方法代码示例

本文整理汇总了C#中Microsoft.Build.Tasks.CommandLineBuilderExtension.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# CommandLineBuilderExtension.ToString方法的具体用法?C# CommandLineBuilderExtension.ToString怎么用?C# CommandLineBuilderExtension.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Build.Tasks.CommandLineBuilderExtension的用法示例。


在下文中一共展示了CommandLineBuilderExtension.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateHasParameter

        /*
         * Method:      ValidateHasParameter
         *
         * Validates that the the given ToolTaskExtension's command line contains the indicated
         * parameter.  Returns the index of the parameter that matched.
         *
         */
        internal static int ValidateHasParameter(ToolTaskExtension t, string parameter, bool useResponseFile)
        {
            CommandLineBuilderExtension b = new CommandLineBuilderExtension();

            if (useResponseFile)
                t.AddResponseFileCommands(b);
            else
                t.AddCommandLineCommands(b);

            string cl = b.ToString();
            string msg = String.Format("Command-line = [{0}]\r\n", cl);
            msg += String.Format(" Searching for [{0}]\r\n", parameter);

            string[] pieces = Parse(cl);

            int i = 0;
            foreach (string s in pieces)
            {
                msg += String.Format(" Parm = [{0}]\r\n", s);
                if (s == parameter)
                {
                    return i;
                }

                i++;
            }

            msg += "Not found!\r\n";
            Console.WriteLine(msg);
            Assert.Fail(msg); // Could not find the parameter.

            return 0;
        }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:40,代码来源:CommandLine_Support.cs

示例2: ARFC

		public void ARFC (CommandLineBuilderExtension commandLine)
		{
			base.AddResponseFileCommands (commandLine);
#if !NET_4_0
			string s = commandLine.ToString ();
			if (s.Length == 6)
				Assert.AreEqual ("/sdk:2", s);
			else
				Assert.AreEqual ("/sdk:2 ", s.Substring (0, 7));

			BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
			PropertyInfo pi = typeof (CommandLineBuilderExtension).GetProperty ("CommandLine", flags);
			System.Text.StringBuilder sb = (System.Text.StringBuilder) pi.GetValue (commandLine, null);
			sb.Length = 0;
			if (s.Length > 6)
				sb.Append (s.Substring (7));
#endif
		}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:18,代码来源:CscTest.cs

示例3: AppendItemWithInvalidBooleanAttribute

        public void AppendItemWithInvalidBooleanAttribute()
        {
            Assert.Throws<ArgumentException>(() =>
            {
                // Construct the task item.
                TaskItem i = new TaskItem();
                i.ItemSpec = "MyResource.bmp";
                i.SetMetadata("Name", "Kenny");
                i.SetMetadata("Private", "Yes");       // This is our flag.

                CommandLineBuilderExtension c = new CommandLineBuilderExtension();

                // Validate that a legitimate bool works first.
                try
                {
                    c.AppendSwitchIfNotNull
                    (
                        "/myswitch:",
                        new ITaskItem[] { i },
                        new string[] { "Name", "Private" },
                        new bool[] { false, true }
                    );
                    Assert.Equal(@"/myswitch:MyResource.bmp,Kenny,Private", c.ToString());
                }
                catch (ArgumentException e)
                {
                    Assert.True(false, "Got an unexpected exception:" + e.Message);
                }

                // Now try a bogus boolean.
                i.SetMetadata("Private", "Maybe");       // This is our flag.
                c.AppendSwitchIfNotNull
                (
                    "/myswitch:",
                    new ITaskItem[] { i },
                    new string[] { "Name", "Private" },
                    new bool[] { false, true }
                );  // <-- Expect an ArgumentException here.
            }
           );
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:41,代码来源:CommandLineBuilderExtension_Tests.cs

示例4: TestWin32Resource

		public void TestWin32Resource ()
		{
			MCExtended mc = new MCExtended ();
			CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
			CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();

			mc.Win32Resource = "A;B";
			mc.ARFC (c1);
			mc.ACLC (c2);
			
			Assert.AreEqual (String.Empty, c1.ToString (), "A1");
			Assert.AreEqual (String.Empty, c2.ToString (), "A2");
		}
开发者ID:BrzVlad,项目名称:mono,代码行数:13,代码来源:ManagedCompilerTest.cs

示例5: TestTreatWarningsAsErrors2

		public void TestTreatWarningsAsErrors2 ()
		{
			MCExtended mc = new MCExtended ();
			CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
			CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();

			mc.TreatWarningsAsErrors = false;
			mc.ARFC (c1);
			mc.ACLC (c2);
			
			Assert.AreEqual ("/warnaserror-", c1.ToString (), "A1");
			Assert.AreEqual (String.Empty, c2.ToString (), "A2");
		}
开发者ID:BrzVlad,项目名称:mono,代码行数:13,代码来源:ManagedCompilerTest.cs

示例6: TestSources

		public void TestSources ()
		{
			MCExtended mc = new MCExtended ();
			CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
			CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();

			mc.Sources = new ITaskItem [2] { new TaskItem ("A"), new TaskItem ("B") };
			mc.ARFC (c1);
			mc.ACLC (c2);
			
			Assert.AreEqual ("/out:A.exe A B", c1.ToString (), "A1");
			Assert.AreEqual (String.Empty, c2.ToString (), "A2");
		}
开发者ID:BrzVlad,项目名称:mono,代码行数:13,代码来源:ManagedCompilerTest.cs

示例7: TestOptimize2

		public void TestOptimize2 ()
		{
			MCExtended mc = new MCExtended ();
			CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
			CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();

			mc.Optimize = false;
			mc.ARFC (c1);
			mc.ACLC (c2);
			
			Assert.AreEqual ("/optimize-", c1.ToString (), "A1");
			Assert.AreEqual (String.Empty, c2.ToString (), "A2");
		}
开发者ID:BrzVlad,项目名称:mono,代码行数:13,代码来源:ManagedCompilerTest.cs

示例8: TestMainEntryPoint

		public void TestMainEntryPoint ()
		{
			MCExtended mc = new MCExtended ();
			CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
			CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();

			mc.MainEntryPoint = "A";
			mc.ARFC (c1);
			mc.ACLC (c2);
			
			Assert.AreEqual (String.Empty, c1.ToString (), "A1");
			Assert.AreEqual (String.Empty, c2.ToString (), "A2");
		}
开发者ID:BrzVlad,项目名称:mono,代码行数:13,代码来源:ManagedCompilerTest.cs

示例9: TestKeyContainer

		public void TestKeyContainer ()
		{
			MCExtended mc = new MCExtended ();
			CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
			CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();

			mc.KeyContainer = "A";
			mc.ARFC (c1);
			mc.ACLC (c2);
			
			Assert.AreEqual ("/keycontainer:A", c1.ToString (), "A1");
			Assert.AreEqual (String.Empty, c2.ToString (), "A2");
		}
开发者ID:BrzVlad,项目名称:mono,代码行数:13,代码来源:ManagedCompilerTest.cs

示例10: TestReferences

		public void TestReferences ()
		{
			CscExtended csc = new CscExtended ();
			CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
			CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();

			csc.References = new ITaskItem [2] { new TaskItem ("A;C"), new TaskItem ("B") };
			csc.ARFC (c1);
			csc.ACLC (c2);

			Assert.AreEqual ("/reference:\"A;C\" /reference:B", c1.ToString (), "A1");
			Assert.AreEqual (String.Empty, c2.ToString (), "A2");
		}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:13,代码来源:CscTest.cs

示例11: TestMainEntryPoint

		public void TestMainEntryPoint ()
		{
			CscExtended csc = new CscExtended ();
			CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
			CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();

			csc.MainEntryPoint = "A;B";
			csc.ARFC (c1);
			csc.ACLC (c2);

			Assert.AreEqual ("/main:\"A;B\"", c1.ToString (), "A1");
			Assert.AreEqual (String.Empty, c2.ToString (), "A2");
		}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:13,代码来源:CscTest.cs

示例12: TestDefineConstants2

		public void TestDefineConstants2 ()
		{
			CscExtended csc = new CscExtended ();
			CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
			CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();

			csc.DefineConstants = ";;;";
			csc.ARFC (c1);
			csc.ACLC (c2);

			Assert.AreEqual (String.Empty, c1.ToString (), "A1");
			Assert.AreEqual (String.Empty, c2.ToString (), "A2");
		}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:13,代码来源:CscTest.cs

示例13: TestDefineConstants

		public void TestDefineConstants ()
		{
			CscExtended csc = new CscExtended ();
			CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
			CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();

			csc.DefineConstants = "A;B;;CD;;;Foo  Bar";
			csc.ARFC (c1);
			csc.ACLC (c2);

			Assert.AreEqual ("/define:\"A;B;CD;Foo;Bar\"", c1.ToString (), "A1");
			Assert.AreEqual (String.Empty, c2.ToString (), "A2");
		}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:13,代码来源:CscTest.cs

示例14: TestAdditionalLibPaths

		public void TestAdditionalLibPaths ()
		{
			CscExtended csc = new CscExtended ();
			CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
			CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();

			csc.AdditionalLibPaths = new string [2] { "A'Foo", "B" };
			csc.ARFC (c1);
			csc.ACLC (c2);

			Assert.AreEqual ("/lib:\"A'Foo\",B", c1.ToString (), "A1");
			Assert.AreEqual (String.Empty, c2.ToString (), "A2");
		}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:13,代码来源:CscTest.cs

示例15: TestWarningNotAsErrors

		public void TestWarningNotAsErrors ()
		{
			CscExtended csc = new CscExtended ();
			CommandLineBuilderExtension clbe = new CommandLineBuilderExtension ();

			csc.WarningsNotAsErrors = "A'B";
			csc.ARFC (clbe);

			Assert.AreEqual ("/warnaserror-:\"A'B\"", clbe.ToString (), "A1");
		}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:10,代码来源:CscTest.cs


注:本文中的Microsoft.Build.Tasks.CommandLineBuilderExtension.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。