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


C# CommandLineBuilderExtension.AppendWhenTrue方法代码示例

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


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

示例1: AddResponseFileCommands

 protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
 {
     if (((this.OutputAssembly == null) && (this.Sources != null)) && ((this.Sources.Length > 0) && (this.ResponseFiles == null)))
     {
         try
         {
             this.OutputAssembly = new TaskItem(Path.GetFileNameWithoutExtension(this.Sources[0].ItemSpec));
         }
         catch (ArgumentException exception)
         {
             throw new ArgumentException(exception.Message, "Sources");
         }
         if (string.Compare(this.TargetType, "library", StringComparison.OrdinalIgnoreCase) == 0)
         {
             ITaskItem outputAssembly = this.OutputAssembly;
             outputAssembly.ItemSpec = outputAssembly.ItemSpec + ".dll";
         }
         else if (string.Compare(this.TargetType, "module", StringComparison.OrdinalIgnoreCase) == 0)
         {
             ITaskItem item2 = this.OutputAssembly;
             item2.ItemSpec = item2.ItemSpec + ".netmodule";
         }
         else
         {
             ITaskItem item3 = this.OutputAssembly;
             item3.ItemSpec = item3.ItemSpec + ".exe";
         }
     }
     commandLine.AppendSwitchIfNotNull("/addmodule:", this.AddModules, ",");
     commandLine.AppendSwitchWithInteger("/codepage:", base.Bag, "CodePage");
     this.ConfigureDebugProperties();
     commandLine.AppendPlusOrMinusSwitch("/debug", base.Bag, "EmitDebugInformation");
     commandLine.AppendSwitchIfNotNull("/debug:", this.DebugType);
     commandLine.AppendPlusOrMinusSwitch("/delaysign", base.Bag, "DelaySign");
     commandLine.AppendSwitchWithInteger("/filealign:", base.Bag, "FileAlignment");
     commandLine.AppendSwitchIfNotNull("/keycontainer:", this.KeyContainer);
     commandLine.AppendSwitchIfNotNull("/keyfile:", this.KeyFile);
     commandLine.AppendSwitchIfNotNull("/linkresource:", this.LinkResources, new string[] { "LogicalName", "Access" });
     commandLine.AppendWhenTrue("/nologo", base.Bag, "NoLogo");
     commandLine.AppendWhenTrue("/nowin32manifest", base.Bag, "NoWin32Manifest");
     commandLine.AppendPlusOrMinusSwitch("/optimize", base.Bag, "Optimize");
     commandLine.AppendSwitchIfNotNull("/out:", this.OutputAssembly);
     commandLine.AppendSwitchIfNotNull("/resource:", this.Resources, new string[] { "LogicalName", "Access" });
     commandLine.AppendSwitchIfNotNull("/target:", this.TargetType);
     commandLine.AppendPlusOrMinusSwitch("/warnaserror", base.Bag, "TreatWarningsAsErrors");
     commandLine.AppendWhenTrue("/utf8output", base.Bag, "Utf8Output");
     commandLine.AppendSwitchIfNotNull("/win32icon:", this.Win32Icon);
     commandLine.AppendSwitchIfNotNull("/win32manifest:", this.Win32Manifest);
     commandLine.AppendFileNamesIfNotNull(this.Sources, " ");
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:50,代码来源:ManagedCompiler.cs

示例2: AddResponseFileCommands

 protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
 {
     commandLine.AppendSwitchIfNotNull("/lib:", base.AdditionalLibPaths, ",");
     commandLine.AppendPlusOrMinusSwitch("/unsafe", base.Bag, "AllowUnsafeBlocks");
     commandLine.AppendPlusOrMinusSwitch("/checked", base.Bag, "CheckForOverflowUnderflow");
     commandLine.AppendSwitchWithSplitting("/nowarn:", this.DisabledWarnings, ",", new char[] { ';', ',' });
     commandLine.AppendWhenTrue("/fullpaths", base.Bag, "GenerateFullPaths");
     commandLine.AppendSwitchIfNotNull("/langversion:", this.LangVersion);
     commandLine.AppendSwitchIfNotNull("/moduleassemblyname:", this.ModuleAssemblyName);
     commandLine.AppendSwitchIfNotNull("/pdb:", this.PdbFile);
     commandLine.AppendPlusOrMinusSwitch("/nostdlib", base.Bag, "NoStandardLib");
     commandLine.AppendSwitchIfNotNull("/platform:", this.Platform);
     commandLine.AppendSwitchIfNotNull("/errorreport:", this.ErrorReport);
     commandLine.AppendSwitchWithInteger("/warn:", base.Bag, "WarningLevel");
     commandLine.AppendSwitchIfNotNull("/doc:", this.DocumentationFile);
     commandLine.AppendSwitchIfNotNull("/baseaddress:", this.BaseAddress);
     commandLine.AppendSwitchUnquotedIfNotNull("/define:", this.GetDefineConstantsSwitch(base.DefineConstants));
     commandLine.AppendSwitchIfNotNull("/win32res:", base.Win32Resource);
     commandLine.AppendSwitchIfNotNull("/main:", base.MainEntryPoint);
     commandLine.AppendSwitchIfNotNull("/appconfig:", this.ApplicationConfiguration);
     this.AddReferencesToCommandLine(commandLine);
     base.AddResponseFileCommands(commandLine);
     commandLine.AppendSwitchWithSplitting("/warnaserror+:", this.WarningsAsErrors, ",", new char[] { ';', ',' });
     commandLine.AppendSwitchWithSplitting("/warnaserror-:", this.WarningsNotAsErrors, ",", new char[] { ';', ',' });
     if (base.ResponseFiles != null)
     {
         foreach (ITaskItem item in base.ResponseFiles)
         {
             commandLine.AppendSwitchIfNotNull("@", item.ItemSpec);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:Csc.cs

示例3: AddResponseFileCommands

 protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
 {
     commandLine.AppendSwitchIfNotNull("/algid:", this.AlgorithmId);
     commandLine.AppendSwitchIfNotNull("/baseaddress:", this.BaseAddress);
     commandLine.AppendSwitchIfNotNull("/company:", this.CompanyName);
     commandLine.AppendSwitchIfNotNull("/configuration:", this.Configuration);
     commandLine.AppendSwitchIfNotNull("/copyright:", this.Copyright);
     commandLine.AppendSwitchIfNotNull("/culture:", this.Culture);
     commandLine.AppendPlusOrMinusSwitch("/delaysign", base.Bag, "DelaySign");
     commandLine.AppendSwitchIfNotNull("/description:", this.Description);
     commandLine.AppendSwitchIfNotNull("/evidence:", this.EvidenceFile);
     commandLine.AppendSwitchIfNotNull("/fileversion:", this.FileVersion);
     commandLine.AppendSwitchIfNotNull("/flags:", this.Flags);
     commandLine.AppendWhenTrue("/fullpaths", base.Bag, "GenerateFullPaths");
     commandLine.AppendSwitchIfNotNull("/keyfile:", this.KeyFile);
     commandLine.AppendSwitchIfNotNull("/keyname:", this.KeyContainer);
     commandLine.AppendSwitchIfNotNull("/main:", this.MainEntryPoint);
     commandLine.AppendSwitchIfNotNull("/out:", (this.OutputAssembly == null) ? null : this.OutputAssembly.ItemSpec);
     commandLine.AppendSwitchIfNotNull("/platform:", this.Platform);
     commandLine.AppendSwitchIfNotNull("/product:", this.ProductName);
     commandLine.AppendSwitchIfNotNull("/productversion:", this.ProductVersion);
     commandLine.AppendSwitchIfNotNull("/target:", this.TargetType);
     commandLine.AppendSwitchIfNotNull("/template:", this.TemplateFile);
     commandLine.AppendSwitchIfNotNull("/title:", this.Title);
     commandLine.AppendSwitchIfNotNull("/trademark:", this.Trademark);
     commandLine.AppendSwitchIfNotNull("/version:", this.Version);
     commandLine.AppendSwitchIfNotNull("/win32icon:", this.Win32Icon);
     commandLine.AppendSwitchIfNotNull("/win32res:", this.Win32Resource);
     commandLine.AppendSwitchIfNotNull("", this.SourceModules, new string[] { "TargetFile" });
     commandLine.AppendSwitchIfNotNull("/embed:", this.EmbedResources, new string[] { "LogicalName", "Access" });
     commandLine.AppendSwitchIfNotNull("/link:", this.LinkResources, new string[] { "LogicalName", "TargetFile", "Access" });
     if (this.ResponseFiles != null)
     {
         foreach (string str in this.ResponseFiles)
         {
             commandLine.AppendSwitchIfNotNull("@", str);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:39,代码来源:AL.cs

示例4: AddCommandLineCommands

 protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
 {
     commandLine.AppendSwitchIfNotNull("/target:", this.LicenseTarget.ItemSpec);
     foreach (ITaskItem item in this.Sources)
     {
         commandLine.AppendSwitchIfNotNull("/complist:", item.ItemSpec);
     }
     commandLine.AppendSwitchIfNotNull("/outdir:", this.OutputDirectory);
     if (this.ReferencedAssemblies != null)
     {
         foreach (ITaskItem item2 in this.ReferencedAssemblies)
         {
             commandLine.AppendSwitchIfNotNull("/i:", item2.ItemSpec);
         }
     }
     commandLine.AppendWhenTrue("/nologo", base.Bag, "NoLogo");
     string str = this.LicenseTarget.ItemSpec + ".licenses";
     if (this.OutputDirectory != null)
     {
         str = Path.Combine(this.OutputDirectory, str);
     }
     this.OutputLicense = new TaskItem(str);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:LC.cs

示例5: AddCommandLineCommands

 protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
 {
     commandLine.AppendFileNameIfNotNull(this.ActiveXControlName);
     commandLine.AppendWhenTrue("/nologo", base.Bag, "NoLogo");
     commandLine.AppendSwitchIfNotNull("/out:", this.OutputAssembly);
     commandLine.AppendSwitchIfNotNull("/rcw:", this.RuntimeCallableWrapperAssembly);
     commandLine.AppendWhenTrue("/silent", base.Bag, "Silent");
     commandLine.AppendWhenTrue("/source", base.Bag, "GenerateSource");
     commandLine.AppendWhenTrue("/verbose", base.Bag, "Verbose");
     base.AddCommandLineCommands(commandLine);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:ResolveComReference.cs

示例6: AddCommandLineCommands

 /// <summary>
 /// Fills the provided CommandLineBuilderExtension with those switches and other information that can't go into a response file and
 /// must go directly onto the command line.
 /// </summary>
 protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
 {
     commandLine.AppendWhenTrue("/noconfig", this.Bag, "NoConfig");
 }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:8,代码来源:ManagedCompiler.cs

示例7: AddResponseFileCommands

        /// <summary>
        /// Fills the provided CommandLineBuilderExtension with those switches and other information that can go into a response file.
        /// </summary>
        protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
        {
            // If outputAssembly is not specified, then an "/out: <name>" option won't be added to
            // overwrite the one resulting from the OutputAssembly member of the CompilerParameters class.
            // In that case, we should set the outputAssembly member based on the first source file.
            if (
                    (OutputAssembly == null) &&
                    (Sources != null) &&
                    (Sources.Length > 0) &&
                    (this.ResponseFiles == null)    // The response file may already have a /out: switch in it, so don't try to be smart here.
                )
            {
                try
                {
                    OutputAssembly = new TaskItem(Path.GetFileNameWithoutExtension(Sources[0].ItemSpec));
                }
                catch (ArgumentException e)
                {
                    throw new ArgumentException(e.Message, "Sources");
                }
                if (String.Compare(TargetType, "library", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    OutputAssembly.ItemSpec += ".dll";
                }
                else if (String.Compare(TargetType, "module", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    OutputAssembly.ItemSpec += ".netmodule";
                }
                else
                {
                    OutputAssembly.ItemSpec += ".exe";
                }
            }

            commandLine.AppendSwitchIfNotNull("/addmodule:", this.AddModules, ",");
            commandLine.AppendSwitchWithInteger("/codepage:", this.Bag, "CodePage");

            ConfigureDebugProperties();

            // The "DebugType" parameter should be processed after the "EmitDebugInformation" parameter
            // because it's more specific.  Order matters on the command-line, and the last one wins.
            // /debug+ is just a shorthand for /debug:full.  And /debug- is just a shorthand for /debug:none.

            commandLine.AppendPlusOrMinusSwitch("/debug", this.Bag, "EmitDebugInformation");
            commandLine.AppendSwitchIfNotNull("/debug:", this.DebugType);

            commandLine.AppendPlusOrMinusSwitch("/delaysign", this.Bag, "DelaySign");

            commandLine.AppendSwitchWithInteger("/filealign:", this.Bag, "FileAlignment");
            commandLine.AppendSwitchIfNotNull("/keycontainer:", this.KeyContainer);
            commandLine.AppendSwitchIfNotNull("/keyfile:", this.KeyFile);
            // If the strings "LogicalName" or "Access" ever change, make sure to search/replace everywhere in vsproject.
            commandLine.AppendSwitchIfNotNull("/linkresource:", this.LinkResources, new string[] { "LogicalName", "Access" });
            commandLine.AppendWhenTrue("/nologo", this.Bag, "NoLogo");
            commandLine.AppendWhenTrue("/nowin32manifest", this.Bag, "NoWin32Manifest");
            commandLine.AppendPlusOrMinusSwitch("/optimize", this.Bag, "Optimize");
            commandLine.AppendSwitchIfNotNull("/out:", this.OutputAssembly);
            commandLine.AppendSwitchIfNotNull("/ruleset:", this.CodeAnalysisRuleSet);
            commandLine.AppendSwitchIfNotNull("/subsystemversion:", this.SubsystemVersion);
            // If the strings "LogicalName" or "Access" ever change, make sure to search/replace everywhere in vsproject.
            commandLine.AppendSwitchIfNotNull("/resource:", this.Resources, new string[] { "LogicalName", "Access" });
            commandLine.AppendSwitchIfNotNull("/target:", this.TargetType);
            commandLine.AppendPlusOrMinusSwitch("/warnaserror", this.Bag, "TreatWarningsAsErrors");
            commandLine.AppendWhenTrue("/utf8output", this.Bag, "Utf8Output");
            commandLine.AppendSwitchIfNotNull("/win32icon:", this.Win32Icon);
            commandLine.AppendSwitchIfNotNull("/win32manifest:", this.Win32Manifest);

            // Append the analyzers.
            this.AddAnalyzersToCommandLine(commandLine);

            // Append additional files.
            this.AddAdditionalFilesToCommandLine(commandLine);

            // Append the sources.
            commandLine.AppendFileNamesIfNotNull(Sources, " ");
        }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:79,代码来源:ManagedCompiler.cs

示例8: AddStrongNameOptions

        /// <summary>
        /// Adds options involving strong name signing -- syntax is the same between 
        /// AxImp and TlbImp
        /// </summary>
        /// <param name="commandLine">The command line to add options to</param>
        private void AddStrongNameOptions(CommandLineBuilderExtension commandLine)
        {
            commandLine.AppendWhenTrue("/delaysign", Bag, "DelaySign");

            // If we're delay-signing, we only need the public key, but if we use the /publickey
            // switch, it will consume the entire key file, assume that's just the public key, and 
            // throw an error.
            // 
            // So use /publickey if that's all our KeyFile contains, but KeyFile otherwise. 
            if (_delaySigningAndKeyFileOnlyContainsPublicKey)
            {
                commandLine.AppendSwitchIfNotNull("/publickey:", KeyFile);
            }
            else
            {
                commandLine.AppendSwitchIfNotNull("/keyfile:", KeyFile);
            }

            commandLine.AppendSwitchIfNotNull("/keycontainer:", KeyContainer);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:25,代码来源:AxTlbBaseTask.cs

示例9: GenerateResGenCommands

            /// <summary>
            /// Generate the command line to be passed to resgen.exe, sans the path to the tool. 
            /// </summary>
            private void GenerateResGenCommands(CommandLineBuilderExtension resGenArguments, bool useForResponseFile)
            {
                resGenArguments = resGenArguments ?? new CommandLineBuilderExtension();

                if (ResGen.IsNullOrEmpty(OutputFiles))
                {
                    GenerateOutputFileNames();
                }

                // Append boolean flags if requested
                string useSourcePathSwitch = "/useSourcePath" + (useForResponseFile ? "\n" : String.Empty);
                string publicClassSwitch = "/publicClass" + (useForResponseFile ? "\n" : String.Empty);
                resGenArguments.AppendWhenTrue(useSourcePathSwitch, Bag, "UseSourcePath");
                resGenArguments.AppendWhenTrue(publicClassSwitch, Bag, "PublicClass");

                // append the references, if any
                if (References != null)
                {
                    foreach (ITaskItem reference in References)
                    {
                        // ResGen.exe response files frown on quotes in filenames, even if there are 
                        // spaces in the names of the files.  
                        if (useForResponseFile && reference != null)
                        {
                            resGenArguments.AppendTextUnquoted("/r:");
                            resGenArguments.AppendTextUnquoted(reference.ItemSpec);
                            resGenArguments.AppendTextUnquoted("\n");
                        }
                        else
                        {
                            resGenArguments.AppendSwitchIfNotNull("/r:", reference);
                        }
                    }
                }

                if (String.IsNullOrEmpty(StronglyTypedLanguage))
                {
                    // append the compile switch
                    resGenArguments.AppendSwitch("/compile" + (useForResponseFile ? "\n" : String.Empty));

                    // append the resources to compile
                    if (InputFiles != null && InputFiles.Length > 0)
                    {
                        ITaskItem[] inputFiles = InputFiles;
                        ITaskItem[] outputFiles = OutputFiles;

                        for (int i = 0; i < inputFiles.Length; ++i)
                        {
                            if (useForResponseFile)
                            {
                                // ResGen.exe response files frown on quotes in filenames, even if there are 
                                // spaces in the names of the files.  
                                if (inputFiles[i] != null && outputFiles[i] != null)
                                {
                                    resGenArguments.AppendTextUnquoted(inputFiles[i].ItemSpec);
                                    resGenArguments.AppendTextUnquoted(",");
                                    resGenArguments.AppendTextUnquoted(outputFiles[i].ItemSpec);
                                    resGenArguments.AppendTextUnquoted("\n");
                                }
                            }
                            else
                            {
                                resGenArguments.AppendFileNamesIfNotNull
                                (
                                    new ITaskItem[] { inputFiles[i], outputFiles[i] },
                                    ","
                                );
                            }
                        }
                    }
                }
                else
                {
                    // append the resource to compile
                    resGenArguments.AppendFileNamesIfNotNull(InputFiles, " ");
                    resGenArguments.AppendFileNamesIfNotNull(OutputFiles, " ");

                    // append the strongly-typed resource details
                    resGenArguments.AppendSwitchIfNotNull
                    (
                        "/str:",
                        new string[] { StronglyTypedLanguage, StronglyTypedNamespace, StronglyTypedClassName, StronglyTypedFileName },
                        ","
                    );
                }
            }
开发者ID:cameron314,项目名称:msbuild,代码行数:89,代码来源:ResGen.cs

示例10: AddCommandLineCommands

            /// <summary>
            /// Fills the provided CommandLineBuilderExtension with all the command line options used when
            /// executing this tool
            /// </summary>
            /// <param name="commandLine">Gets filled with command line commands</param>
            protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
            {
                // .ocx file being imported
                commandLine.AppendFileNameIfNotNull(TypeLibName);

                // options
                commandLine.AppendSwitchIfNotNull("/asmversion:", (AssemblyVersion != null) ? AssemblyVersion.ToString() : null);
                commandLine.AppendSwitchIfNotNull("/namespace:", AssemblyNamespace);
                commandLine.AppendSwitchIfNotNull("/machine:", Machine);
                commandLine.AppendWhenTrue("/noclassmembers", Bag, "PreventClassMembers");
                commandLine.AppendWhenTrue("/nologo", Bag, "NoLogo");
                commandLine.AppendSwitchIfNotNull("/out:", OutputAssembly);
                commandLine.AppendWhenTrue("/silent", Bag, "Silent");
                commandLine.AppendWhenTrue("/sysarray", Bag, "SafeArrayAsSystemArray");
                commandLine.AppendSwitchIfNotNull("/transform:", ConvertTransformFlagsToCommandLineCommand(Transform));
                commandLine.AppendWhenTrue("/verbose", Bag, "Verbose");
                if (ReferenceFiles != null)
                {
                    foreach (var referenceFile in ReferenceFiles)
                    {
                        commandLine.AppendSwitchIfNotNull("/reference:", referenceFile);
                    }
                }

                base.AddCommandLineCommands(commandLine);
            }
开发者ID:cameron314,项目名称:msbuild,代码行数:31,代码来源:TlbImp.cs

示例11: AddResponseFileCommands

        /// <summary>
        /// Fills the provided CommandLineBuilderExtension with those switches and other information that can go into a response file.
        /// </summary>
        override protected internal void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
        {
            commandLine.AppendSwitchIfNotNull("/lib:", this.AdditionalLibPaths, ",");
            commandLine.AppendPlusOrMinusSwitch("/unsafe", this.Bag, "AllowUnsafeBlocks");
            commandLine.AppendPlusOrMinusSwitch("/checked", this.Bag, "CheckForOverflowUnderflow");
            commandLine.AppendSwitchWithSplitting("/nowarn:", this.DisabledWarnings, ",", ';', ',');
            commandLine.AppendWhenTrue("/fullpaths", this.Bag, "GenerateFullPaths");
            commandLine.AppendSwitchIfNotNull("/langversion:", this.LangVersion);
            commandLine.AppendSwitchIfNotNull("/moduleassemblyname:", this.ModuleAssemblyName);
            commandLine.AppendSwitchIfNotNull("/pdb:", this.PdbFile);
            commandLine.AppendPlusOrMinusSwitch("/nostdlib", this.Bag, "NoStandardLib");
            commandLine.AppendSwitchIfNotNull("/platform:", this.PlatformWith32BitPreference);
            commandLine.AppendSwitchIfNotNull("/errorreport:", this.ErrorReport);
            commandLine.AppendSwitchWithInteger("/warn:", this.Bag, "WarningLevel");
            commandLine.AppendSwitchIfNotNull("/doc:", this.DocumentationFile);
            commandLine.AppendSwitchIfNotNull("/baseaddress:", this.BaseAddress);
            commandLine.AppendSwitchUnquotedIfNotNull("/define:", this.GetDefineConstantsSwitch(this.DefineConstants));
            commandLine.AppendSwitchIfNotNull("/win32res:", this.Win32Resource);
            commandLine.AppendSwitchIfNotNull("/main:", this.MainEntryPoint);
            commandLine.AppendSwitchIfNotNull("/appconfig:", this.ApplicationConfiguration);
            commandLine.AppendWhenTrue("/errorendlocation", this.Bag, "ErrorEndLocation");
            commandLine.AppendSwitchIfNotNull("/preferreduilang:", this.PreferredUILang);
            commandLine.AppendPlusOrMinusSwitch("/highentropyva", this.Bag, "HighEntropyVA");

            // If not design time build and the globalSessionGuid property was set then add a -globalsessionguid:<guid>
            bool designTime = false;
            if (this.HostObject != null)
            {
                var csHost = this.HostObject as ICscHostObject;
                designTime = csHost.IsDesignTime();
            }
            if (!designTime)
            {
                if (!string.IsNullOrWhiteSpace(this.VsSessionGuid))
                {
                    commandLine.AppendSwitchIfNotNull("/sqmsessionguid:", this.VsSessionGuid);
                }
            }

            this.AddReferencesToCommandLine(commandLine);

            base.AddResponseFileCommands(commandLine);

            // This should come after the "TreatWarningsAsErrors" flag is processed (in managedcompiler.cs).
            // Because if TreatWarningsAsErrors=false, then we'll have a /warnaserror- on the command-line,
            // and then any specific warnings that should be treated as errors should be specified with
            // /warnaserror+:<list> after the /warnaserror- switch.  The order of the switches on the command-line
            // does matter.
            //
            // Note that
            //      /warnaserror+
            // is just shorthand for:
            //      /warnaserror+:<all possible warnings>
            //
            // Similarly,
            //      /warnaserror-
            // is just shorthand for:
            //      /warnaserror-:<all possible warnings>
            commandLine.AppendSwitchWithSplitting("/warnaserror+:", this.WarningsAsErrors, ",", ';', ',');
            commandLine.AppendSwitchWithSplitting("/warnaserror-:", this.WarningsNotAsErrors, ",", ';', ',');

            // It's a good idea for the response file to be the very last switch passed, just 
            // from a predictability perspective.
            if (this.ResponseFiles != null)
            {
                foreach (ITaskItem response in this.ResponseFiles)
                {
                    commandLine.AppendSwitchIfNotNull("@", response.ItemSpec);
                }
            }
        }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:74,代码来源:Csc.cs

示例12: GenerateCommandLineCommands

 protected override string GenerateCommandLineCommands()
 {
     CommandLineBuilderExtension extension = new CommandLineBuilderExtension();
     bool flag = false;
     try
     {
         if (this.SerializationAssembly == null)
         {
             this.SerializationAssembly = new TaskItem[] { new TaskItem(this.SerializationAssemblyPath) };
         }
         extension.AppendSwitchIfNotNull("/assembly:", this.AssemblyFullPath);
         extension.AppendWhenTrue("/proxytypes", base.Bag, "UseProxyTypes");
         if (this.References != null)
         {
             foreach (string str in this.References)
             {
                 extension.AppendSwitchIfNotNull("/reference:", str);
             }
         }
         if (this.Types != null)
         {
             foreach (string str2 in this.Types)
             {
                 extension.AppendSwitchIfNotNull("/type:", str2);
             }
         }
         if (this.KeyFile != null)
         {
             extension.AppendNestedSwitch("/compiler:", "/keyfile:", this.KeyFile);
         }
         else if (this.KeyContainer != null)
         {
             extension.AppendNestedSwitch("/compiler:", "/keycontainer:", this.KeyContainer);
         }
         extension.AppendPlusOrMinusSwitch("/compiler:/delaysign", base.Bag, "DelaySign");
         if (this.Platform != null)
         {
             extension.AppendNestedSwitch("/compiler:", "/platform:", this.Platform);
         }
         flag = File.Exists(this.SerializationAssemblyPath);
     }
     catch (Exception exception)
     {
         if (Microsoft.Build.Shared.ExceptionHandling.NotExpectedException(exception))
         {
             throw;
         }
     }
     if (flag)
     {
         try
         {
             File.Delete(this.SerializationAssemblyPath);
         }
         catch (UnauthorizedAccessException exception2)
         {
             base.Log.LogErrorWithCodeFromResources("SGen.CouldNotDeleteSerializer", new object[] { this.SerializationAssemblyPath, exception2.Message });
         }
         catch (IOException exception3)
         {
             base.Log.LogErrorWithCodeFromResources("SGen.CouldNotDeleteSerializer", new object[] { this.SerializationAssemblyPath, exception3.Message });
         }
     }
     return extension.ToString();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:65,代码来源:SGen.cs

示例13: AddCommandLineCommands

        /// <summary>
        /// Fills the provided CommandLineBuilderExtension with all the command line options used when
        /// executing this tool
        /// </summary>
        /// <param name="commandLine">Gets filled with command line commands</param>
        protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            commandLine.AppendSwitchIfNotNull("/d:", OutputDocumentationFile);
            commandLine.AppendSwitchIfNotNull("/md:", InputDocumentationFile);
            commandLine.AppendSwitchIfNotNull("/mp:", InputPDBFile);
            commandLine.AppendSwitchIfNotNull("/pdb:", OutputPDBFile);
            commandLine.AppendSwitchIfNotNull("/assemblyunificationpolicy:", AssemblyUnificationPolicy);

            if (String.IsNullOrEmpty(OutputWindowsMetadataFile))
            {
                OutputWindowsMetadataFile = Path.ChangeExtension(WinMDModule, ".winmd");
            }

            commandLine.AppendSwitchIfNotNull("/out:", OutputWindowsMetadataFile);
            commandLine.AppendSwitchWithSplitting("/nowarn:", DisabledWarnings, ",", ';', ',');
            commandLine.AppendWhenTrue("/warnaserror+", this.Bag, "TreatWarningsAsErrors");
            commandLine.AppendWhenTrue("/utf8output", this.Bag, "UTF8Output");

            if (References != null)
            {
                // Loop through all the references passed in.  We'll be adding separate
                foreach (ITaskItem reference in this.References)
                {
                    commandLine.AppendSwitchIfNotNull("/reference:", reference.ItemSpec);
                }
            }

            commandLine.AppendFileNameIfNotNull(WinMDModule);

            base.AddCommandLineCommands(commandLine);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:36,代码来源:WinMDExp.cs

示例14: AddResponseFileCommands

 protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
 {
     commandLine.AppendSwitchIfNotNull("/baseaddress:", this.GetBaseAddressInHex());
     commandLine.AppendSwitchIfNotNull("/libpath:", base.AdditionalLibPaths, ",");
     commandLine.AppendSwitchIfNotNull("/imports:", this.Imports, ",");
     commandLine.AppendPlusOrMinusSwitch("/doc", base.Bag, "GenerateDocumentation");
     commandLine.AppendSwitchIfNotNull("/optioncompare:", this.OptionCompare);
     commandLine.AppendPlusOrMinusSwitch("/optionexplicit", base.Bag, "OptionExplicit");
     object obj2 = base.Bag["OptionStrict"];
     if ((obj2 != null) ? ((bool) obj2) : false)
     {
         commandLine.AppendSwitch("/optionstrict+");
     }
     else
     {
         commandLine.AppendSwitch("/optionstrict:custom");
     }
     commandLine.AppendSwitchIfNotNull("/optionstrict:", this.OptionStrictType);
     commandLine.AppendWhenTrue("/nowarn", base.Bag, "NoWarnings");
     commandLine.AppendSwitchWithSplitting("/nowarn:", this.DisabledWarnings, ",", new char[] { ';', ',' });
     commandLine.AppendPlusOrMinusSwitch("/optioninfer", base.Bag, "OptionInfer");
     commandLine.AppendWhenTrue("/nostdlib", base.Bag, "NoStandardLib");
     commandLine.AppendWhenTrue("/novbruntimeref", base.Bag, "NoVBRuntimeReference");
     commandLine.AppendSwitchIfNotNull("/errorreport:", this.ErrorReport);
     commandLine.AppendSwitchIfNotNull("/platform:", this.Platform);
     commandLine.AppendPlusOrMinusSwitch("/removeintchecks", base.Bag, "RemoveIntegerChecks");
     commandLine.AppendSwitchIfNotNull("/rootnamespace:", this.RootNamespace);
     commandLine.AppendSwitchIfNotNull("/sdkpath:", this.SdkPath);
     commandLine.AppendSwitchIfNotNull("/langversion:", this.LangVersion);
     commandLine.AppendSwitchIfNotNull("/moduleassemblyname:", this.ModuleAssemblyName);
     commandLine.AppendWhenTrue("/netcf", base.Bag, "TargetCompactFramework");
     if (this.VBRuntime != null)
     {
         string vBRuntime = this.VBRuntime;
         if (string.Compare(vBRuntime, "EMBED", StringComparison.OrdinalIgnoreCase) == 0)
         {
             commandLine.AppendSwitch("/vbruntime*");
         }
         else if (string.Compare(vBRuntime, "NONE", StringComparison.OrdinalIgnoreCase) == 0)
         {
             commandLine.AppendSwitch("/vbruntime-");
         }
         else if (string.Compare(vBRuntime, "DEFAULT", StringComparison.OrdinalIgnoreCase) == 0)
         {
             commandLine.AppendSwitch("/vbruntime+");
         }
         else
         {
             commandLine.AppendSwitchIfNotNull("/vbruntime:", vBRuntime);
         }
     }
     if ((this.Verbosity != null) && ((string.Compare(this.Verbosity, "quiet", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(this.Verbosity, "verbose", StringComparison.OrdinalIgnoreCase) == 0)))
     {
         commandLine.AppendSwitchIfNotNull("/", this.Verbosity);
     }
     commandLine.AppendSwitchIfNotNull("/doc:", this.DocumentationFile);
     commandLine.AppendSwitchUnquotedIfNotNull("/define:", GetDefineConstantsSwitch(base.DefineConstants));
     this.AddReferencesToCommandLine(commandLine);
     commandLine.AppendSwitchIfNotNull("/win32resource:", base.Win32Resource);
     if (string.Compare("Sub Main", base.MainEntryPoint, StringComparison.OrdinalIgnoreCase) != 0)
     {
         commandLine.AppendSwitchIfNotNull("/main:", base.MainEntryPoint);
     }
     base.AddResponseFileCommands(commandLine);
     commandLine.AppendSwitchWithSplitting("/warnaserror+:", this.WarningsAsErrors, ",", new char[] { ';', ',' });
     commandLine.AppendSwitchWithSplitting("/warnaserror-:", this.WarningsNotAsErrors, ",", new char[] { ';', ',' });
     if (base.ResponseFiles != null)
     {
         foreach (ITaskItem item in base.ResponseFiles)
         {
             commandLine.AppendSwitchIfNotNull("@", item.ItemSpec);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:74,代码来源:Vbc.cs

示例15: AddStrongNameOptions

 private void AddStrongNameOptions(CommandLineBuilderExtension commandLine)
 {
     commandLine.AppendWhenTrue("/delaysign", base.Bag, "DelaySign");
     commandLine.AppendSwitchIfNotNull("/keyfile:", this.KeyFile);
     commandLine.AppendSwitchIfNotNull("/keycontainer:", this.KeyContainer);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:6,代码来源:AxTlbBaseTask.cs


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