示例#1
0
        /// <summary>
        /// Builds the project according to the current profile.
        /// </summary>
        /// <param name="cabwiz">The cabwiz application reference</param>
        /// <param name="feedback">The build context.</param>
        /// <returns>A value indicating whether the build was successful.</returns>
        public bool Build(Cabwiz.CabwizApplication cabwiz, IBuildFeedback feedback)
        {
            var project = this.Profile.ProjectInfo;
            var profile = this.Profile;

            if (cabwiz == null)
            {
                throw new ArgumentNullException("cabwiz", "Missing reference to a CabwizApplication object.");
            }

            var output = project.GetOutput(profile);

            // Create the .INF file for Cabwiz to process.
            var inf = output.CreateCabwizInf(profile);

            // Set the output directory
            cabwiz.DestinationDirectory = project.GetOutputDirectory(profile);

            // add some feedback
            feedback.WriteLine("   > {0}", cabwiz.PreviewCommandLine(inf));

            int exitCode = cabwiz.Run(inf);
            if (exitCode != 0)
            {
                feedback.WriteLine("   {0} returned {1}", System.IO.Path.GetFileName(cabwiz.FileName), exitCode);

                return false;
            }
            else
            {
                return true;
            }
        }