Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
 
Add your own
alternative version

A WIX web setup

, 9 May 2007
Create WIX web setup using VS2005 and Wix 3.0
componentwriter.zip
ComponentWriter
bin
Debug
Djans.ComponentWriter.exe
Djans.ComponentWriter.pdb
Release
Djans.ComponentWriter.exe
Djans.ComponentWriter.suo
obj
Debug
Djans.ComponentWriter.exe
Djans.ComponentWriter.pdb
TempPE
Release
Djans.ComponentWriter.exe
LogicaCMG.ComponentWriter.exe
Refactor
TempPE
Properties
app.manifest
wixwebsetup.zip
WixWebSetup
SolutionItems
Djans.ComponentWriter.exe
Djans.CustomInstaller.dll
WebApplication1.csproj_deploy
Debug
Release
bin
Djans.CustomInstaller.dll
WebApplication1.dll
Properties
WebApplication1.csproj_deploy.wdproj
WebApplication1
bin
WebApplication1.dll
WebApplication1.pdb
obj
Debug
TempPE
WebApplication1.dll
WebApplication1.pdb
Release
TempPE
WebApplication1.dll
WebApplication1.pdb
Properties
WebApplication1.csproj.user
WixSetup
Actions.wxs
bin
Debug
Release
WixSetup.msi
Binary
DefBannerBitmap.ibd
InstallUtil.ibd
InstallUtilLib.dll
MSVBDPCADLL.ibd
NewFldrBtn.ibd
UpFldrBtn.ibd
VSDNETCFG.ibd
Components.wxs
obj
Release
Actions.wixobj
Components.wixobj
Properties.wixobj
UserInterface.wixobj
WixSetup.wixobj
Properties.wxs
UserInterface.wxs
WixSetup.wixproj
WixSetup.wxs
WixWebSetup.suo
#region Using directives
using System;
using System.Collections.Generic;
using System.Text; 
#endregion

namespace Djans.ComponentWriter
{
    /// <summary>
    /// Starts the ComponentWriter from command line
    /// </summary>
    class Program
    {
        public static void Main(string[] args)
        {
            // Invalid no of arguments
            if (args.Length == 0)
            {                
                DisplayHelp();
                return;
            }

            // Help
            if ((args.Length == 1)
                && ((args[0] == "/?") 
                || (args[0] == "?") 
                || (args[0] == "-?")
                || (args[0] == "help")))
            {
                DisplayHelp();
                return;
            }

            // Invalid no of arguments
            if (args.Length != 3)
            {
                Console.WriteLine(string.Format("Error: Invalid no of arguments given."));
                DisplayHelp();
                return;
            }

            try
            {
                // Get the config from the command line
                ComponentWriterConfig config = new ComponentWriterConfig();
                config.SourceDirectory = args[0];
                config.OutputFile = args[1];
                config.UgradeFile = args[2];

                // Do the actual writing
                ComponentWriter componentWriter = new ComponentWriter();
                if (componentWriter.Write(config))
                {
                    Console.WriteLine("Files written successfully.");
                }
                else
                {
                    Console.WriteLine("Error: Could not write file. ComponentWriter Failed.");
                }
            }
            catch 
            {
                Console.WriteLine(string.Format("Error: Improper arguments given."));
                DisplayHelp();
                return;
            }
        }

        /// <summary>
        /// Displays Help
        /// </summary>
        private static void DisplayHelp()
        {
            StringBuilder help = new StringBuilder();
            help.AppendLine(Environment.NewLine + "-- HELP --");
            help.AppendLine(Environment.NewLine + "Description: Writes the files list from the given source directory in WIX format and upgrades the version number.");
            help.AppendLine(Environment.NewLine + "Switches: '?', '/?', '-?', 'help' diplays this help.");
            help.AppendLine("\t '-skip' skips updating the upgrade code.");
            help.AppendLine(Environment.NewLine + "Usage: \n ComponentWriter.exe [SourceDirectory] [OutputFile] [UgradeFile]");
            help.AppendLine("[SourceDirectory]: (Mandatory) The complete physical path of the directory where source files are stored.");
            help.AppendLine("                   The source files are those files which will be used for deployment.");
            help.AppendLine("[OutputFile]: (Mandatory) The wix file which lists out the directory structure, the files to be deployed and the feature element.");
            help.AppendLine("[UgradeFile]: (Optional) The wix file which has the upgrade element.");
            help.AppendLine("\t      To skip using upgrade, instead of the file name, provide '-skip' as the argument.");
            help.AppendLine(Environment.NewLine + "Example:");
            help.AppendLine("Write component file and upgrade the version: ");
            help.AppendLine(@"    Djans.ComponentWriter.exe c:\Project\Source c:\Project\WixSetup\Component.wxs c:\Project\WixSetup\WixMain.wxs");
            help.AppendLine("Write component file and do not upgrade the version: ");
            help.AppendLine(@"    Djans.ComponentWriter.exe c:\Project\Source c:\Project\WixSetup\Component.wxs -skip");
            help.AppendLine(Environment.NewLine + "Note: [UgradeFile] updates only first 3 parts, the 4th part is always 0 in the 4 part versioning.");
            Console.WriteLine(help.ToString());
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

JannuD
Architect
India India
No Biography provided

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 10 May 2007
Article Copyright 2007 by JannuD
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid