Candle.cs :  » Installers-Generators » WiX » Microsoft » Tools » WindowsInstallerXml » Build » Tasks » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Installers Generators » WiX 
WiX » Microsoft » Tools » WindowsInstallerXml » Build » Tasks » Candle.cs
//-------------------------------------------------------------------------------------------------
// <copyright file="CandleTask.cs" company="Microsoft">
//    Copyright (c) Microsoft Corporation.  All rights reserved.
//    
//    The use and distribution terms for this software are covered by the
//    Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
//    which can be found in the file CPL.TXT at the root of this distribution.
//    By using this software in any fashion, you are agreeing to be bound by
//    the terms of this license.
//    
//    You must not remove this notice, or any other, from this software.
// </copyright>
// 
// <summary>
// Build task to execute the compiler of the Windows Installer Xml toolset.
// </summary>
//-------------------------------------------------------------------------------------------------

namespace Microsoft.Tools.WindowsInstallerXml.Build.Tasks{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Globalization;
    using System.IO;
    using System.Text;

    using Microsoft.Build.Framework;
    using Microsoft.Build.Utilities;

    /// <summary>
    /// An MSBuild task to run the WiX compiler.
    /// </summary>
    public sealed class Candle : WixToolTask
    {
        private const string CandleToolName = "candle.exe";

        private string[] defineConstants;
        private ITaskItem[] extensions;
        private bool suppressFilesVitalByDefault;
        private string[] includeSearchPaths;
        private bool onlyValidateDocuments;
        private ITaskItem outputFile;
        private bool pedantic;
        private string installerPlatform;
        private string preprocessToFile;
        private bool preprocessToStdOut;
        private bool showSourceTrace;
        private ITaskItem[] sourceFiles;
        private bool suppressSchemaValidation;
        private string extensionDirectory;
        private string[] referencePaths;
        private bool fipsCompliant;

        public string[] DefineConstants
        {
            get { return this.defineConstants; }
            set { this.defineConstants = value; }
        }

        public ITaskItem[] Extensions
        {
            get { return this.extensions; }
            set { this.extensions = value; }
        }

        public bool SuppressFilesVitalByDefault
        {
            get { return this.suppressFilesVitalByDefault; }
            set { this.suppressFilesVitalByDefault = value; }
        }

        public string[] IncludeSearchPaths
        {
            get { return this.includeSearchPaths; }
            set { this.includeSearchPaths = value; }
        }

        public string InstallerPlatform
        {
            get { return this.installerPlatform; }
            set { this.installerPlatform = value; }
        }

        public bool OnlyValidateDocuments
        {
            get { return this.onlyValidateDocuments; }
            set { this.onlyValidateDocuments = value; }
        }

        [Output]
        [Required]
        public ITaskItem OutputFile
        {
            get { return this.outputFile; }
            set { this.outputFile = value; }
        }

        public bool Pedantic
        {
            get { return this.pedantic; }
            set { this.pedantic = value; }
        }

        public string PreprocessToFile
        {
            get { return this.preprocessToFile; }
            set { this.preprocessToFile = value; }
        }

        public bool PreprocessToStdOut
        {
            get { return this.preprocessToStdOut; }
            set { this.preprocessToStdOut = value; }
        }

        public bool ShowSourceTrace
        {
            get { return this.showSourceTrace; }
            set { this.showSourceTrace = value; }
        }

        [Required]
        public ITaskItem[] SourceFiles
        {
            get { return this.sourceFiles; }
            set { this.sourceFiles = value; }
        }

        public bool SuppressSchemaValidation
        {
            get { return this.suppressSchemaValidation; }
            set { this.suppressSchemaValidation = value; }
        }

        public string ExtensionDirectory
        {
            get { return this.extensionDirectory; }
            set { this.extensionDirectory = value; }
        }

        public string[] ReferencePaths
        {
            get { return this.referencePaths; }
            set { this.referencePaths = value; }
        }

        public bool FipsCompliant
        {
            get { return this.fipsCompliant; }
            set { this.fipsCompliant = value; }
        }

        /// <summary>
        /// Get the name of the executable.
        /// </summary>
        /// <remarks>The ToolName is used with the ToolPath to get the location of candle.exe.</remarks>
        /// <value>The name of the executable.</value>
        protected override string ToolName
        {
            get { return CandleToolName; }
        }

        /// <summary>
        /// Get the path to the executable. 
        /// </summary>
        /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
        /// <returns>The full path to the executable or simply candle.exe if it's expected to be in the system path.</returns>
        protected override string GenerateFullPathToTool()
        {
            // If there's not a ToolPath specified, it has to be in the system path.
            if (String.IsNullOrEmpty(this.ToolPath))
            {
                return CandleToolName;
            }

            return Path.Combine(Path.GetFullPath(this.ToolPath), CandleToolName);
        }

        /// <summary>
        /// Builds a command line from options in this task.
        /// </summary>
        protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
        {
            base.BuildCommandLine(commandLineBuilder);

            commandLineBuilder.AppendArrayIfNotNull("-d", this.DefineConstants);
            commandLineBuilder.AppendIfTrue("-p", this.PreprocessToStdOut);
            commandLineBuilder.AppendSwitchIfNotNull("-p", this.PreprocessToFile);
            commandLineBuilder.AppendIfTrue("-sfdvital", this.suppressFilesVitalByDefault);
            commandLineBuilder.AppendArrayIfNotNull("-I", this.IncludeSearchPaths);
            commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
            commandLineBuilder.AppendIfTrue("-pedantic", this.Pedantic);
            commandLineBuilder.AppendSwitchIfNotNull("-arch ", this.InstallerPlatform);
            commandLineBuilder.AppendIfTrue("-ss", this.SuppressSchemaValidation);
            commandLineBuilder.AppendIfTrue("-trace", this.ShowSourceTrace);
            commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.referencePaths);
            commandLineBuilder.AppendIfTrue("-zs", this.OnlyValidateDocuments);
            commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
            commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " ");
            commandLineBuilder.AppendIfTrue("-fips", this.fipsCompliant);
        }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.