SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Matt Ward

September 2006 - Posts

  • WiX Integration

    Support for creating WiX setup packages is now available in SharpDevelop 2.1. It was originally disabled in SharpDevelop 2.0, but has now been re-enabled and some new features have been added. It is still a work in progress. Some parts are not quite finished and there are some missing features, but it is currently being used to build and maintain the installer for SharpDevelop itself. At the moment SharpDevelop ships with WiX 2.0.4221, but it will be updated to 2.0.4415.0 shortly.

    Features

    • WiX project and file templates.
    • Build a setup package (.msi), merge module (.msm) or WiX Library (.wixlib) from inside SharpDevelop. All built using MSBuild and WiX's custom MSBuild tasks.
    • Add WiX libraries, WiX extensions and preprocessor variables to the WiX project.
    • WiX Dialog Designer.
    • Setup Dialogs window. Lists all dialogs in a project. Each dialog can then be opened up in the designer.
    • Setup Files editor. Add directories, components and files to the installer via a GUI instead of editing the XML.

    The next sections will look at the WiX support in more detail.

    Creating a WiX Project

    To create a new WiX project, from the File menu, select New and then select Solution.... In the New Project dialog select the Setup category.

    WiX project templates in the New Project dialog

    SharpDevelop has two WiX project templates available

    • Empty Setup.

      This project template creates a Solution (.sln), a WiX Project (.wixproj) and a minimal WiX Setup file (.wxs).

    • Setup.

      The Setup project template creates a basic WiX project which can be built immediately after creation.

      Setup project open in Project Browser

      The installer created by this project installs a License.rtf file to the installation directory.

      The Setup project template also has its own dialogs which can be customised.

    The Setup project is the project we will be using in this walkthrough.

    Building

    Building the WiX project is done in the same way as for other projects in SharpDevelop from the build menu.

    Build menu for MySetup project

    Output messages from the WiX compiler and linker are displayed in the Output window and any errors are added to the Errors window.

    Creating a Merge Module or WiX Library

    By default the project will build an MSI file. You can choose to create a merge module (.msm) or WiX Library (.wixlib) from the project options. Select the project in the Project Browser, then from the Project menu select Project Options.

    WiX Project options

    From the Application tab you can change the output type to msi, msm or wixlib.

    WiX Project output types

    Running

    To run the installer, select Run from the Debug menu or press F5. The installer will then be built and run and you will see the first dialog of your installer.

    Running the installer from inside SharpDevelop

    Adding a new WiX File

    You can either have one big WiX setup file (.wxs) or split the project up into several different files. The WiX MSBuild tasks will compile all the WiX files and link them all into one installer.

    To add a new WiX file, select the project in the Project Browser window, right click, select Add and then select New Item.... From the New File dialog selecting the Setup category will show you the WiX file templates.

    WiX file templates in File dialog

    Adding WiX Libraries

    To add a wixlib to your project, select WiX Libraries in the Project Browser, right click and select Add WiX Library.

    Add WiX Library menu item

    This opens up the file dialog where you can browse to one or more wixlibs and add them to the project.

    Adding WiX Extensions

    WiX extensions can be added to the project in the Compiling, Library and Linking tabs available from the project options. The Compiling tab determines what extensions are passed to Candle the WiX compiler. The Linking tab determines what extensions get passed to Light the WiX linker. The Library tab determines what extensions get passed to Lit the Wix Library Tool. If you are creating a setup package (.msi) then typically you should put the extensions in the Compiling and Linking tab. If you are creating a WiX Library (.wixlib) then you need to put the extensions in the Library tab.

    WiX Linking tab showing extensions

    The extensions can either be typed in directly into the Extensions text box, one per line, as shown above, or you can click the Add button to open the Add Extensions dialog and select one or more of the standard extensions WiX provides.

    Add WiX Extensions dialog

    Preprocessor Variables

    Preprocessor variables can be added in the Preprocessing tab available from the project options.

    WiX Preprocessor Variables defined in project options

    In the screenshot above the DATADIR variable is defined. Generally the variable values will just be strings, but you can also use MSBuild properties. In the screenshot above the SharpDevelopBinPath MSBuild property is being used. You can use MSBuild properties here since these properties will be expanded before WiX compiles anything.

    In the UserInterface.wxs file the DATADIR preprocessor variable is referenced as shown below:

    <Binary Id="dialog.bmp" SourceFile="$(var.DATADIR)/default-dialog.bmp" />

    Visually Designing a Dialog

    To open a setup dialog in the designer, open the WiX file, move the cursor so it is inside the dialog element, then click the Design tab.

    WiX dialog in designer

    You can also open a dialog in the designer from the Setup Dialogs Window, which is described in the next section.

    You can have multiple dialogs defined in one WiX file or create one file per dialog, it is up to you. If you have multiple dialogs then you need to move the cursor inside the dialog element before you select the Design tab otherwise the designer will not know which dialog to load. If you have only one dialog element in the file then the cursor can be anywhere in the WiX document and does not need to be inside the dialog element.

    In the designer you can reposition, resize and remove existing controls. You can also add new WiX controls from the Setup Dialog Controls tab by dragging them to the dialog.

    Setup dialog controls in the toolbox

    At the moment not all the WiX controls are supported and WiX specific properties are not available in the properties window.

    Setup Dialogs Window

    To open the Setup Dialogs window, from the View menu select Setup and then select Dialogs.

    View setup dialogs menu item

    The Setup Dialogs window is then opened.

    Setup dialogs window

    This window lists all the dialogs available in the project. You can open a dialog into the designer by right clicking it and selecting Open. Or view its XML by selecting View Code.

    Visually Editing Directories, Components and Files

    To open the Setup Files Editor, from the View menu select Setup and then select Files.

    The Setup Files Editor will look at all the WiX files in the project for the TARGETDIR Directory element or the DirectoryRef element. Once this is found then it will show the directories, components and files that will be installed.

    Files editor

    The left hand side of the editor shows the files in a tree view. On the right hand side of the editor you can modify the properties of the currently selected item.

    You can add directories, files and components to your installer by right clicking a tree node, selecting Add and then choosing an item to add.

    Setup Files editor add menu

    Adding Directories

    To add a directory and all its contents recursively to your setup, select the tree node where you want your directory added to, then right click and select Add Directory.

    Add directories menu item

    This opens the Browser for Folder dialog. Select the directory and then click OK to have that directory and all its contents added to the setup package. Every file added will have its own component.

    Future Improvements

    The WiX integration is not completely finished. Here is a list of items that will hopefully be added at some point.

    • Improve the WiX dialog designer. Add support for all the WiX controls.
    • Improve the files editor.

      • Drag and drop support.
      • Directory vs installer diff. Shows missing and new files.
    • Add support for WiX include files (.wxi).
    • Add GUI Editors for:

      • Features
      • Properties
      • Binaries
      • Icons
      • Sequences
      • Error and UI Text.

    Alternatives

    There are a few other applications and plug-ins available that can be used to create WiX installers instead of SharpDevelop. Here is a list of the ones I am aware of.

    Votive

    Votive is a Visual Studio plug-in that you can use to create WiX setup packages from inside Visual Studio.

    Just a few days ago, September 15th, Justin Rockwood released Votive version 3, which supports Visual Studio 2005. It does not have a dialog designer, but that is on its list of features that will be added in the future.

    WiX Edit

    WiX Edit is a standalone WiX Editor application, created by Jasper Keuper, that you can use to create WiX setup packages. It includes a dialog designer along with a whole host of other features, that SharpDevelop does not have. In fact you can create an installer and never look at any XML.

    WixTrim

    WixTrim is a WiX Visual Editor, created by Oleg Zelenkov, that supports a very advanced dialog designer amongst other features. The source code for the editor is also available from GotDotNet. Unfortunately, WixTrim is not under active development like the previous two.

    WiX Tutorial

    If you want to learn more about WiX then a fantastic WiX tutorial, created by Gabor Deak Jahn, is available online.

    Posted Sep 17 2006, 03:14 PM by MattWard with 6 comment(s)
    Filed under:
  • Incremental Search

    SharpDevelop 2.1 now supports incremental searching. For those of you who have used Visual Studio, the incremental search works in a similar way. First you enter incremental search mode, then type in the search text. As you type in each character the document is searched from the current cursor position and the first match it finds is highlighted.

    Features

    • Ctrl+E enables incremental searching. The search will start from the current cursor position and move down the document.
    • Ctrl+Shift+E enables reverse incremental searching. The search will start from the current position and move up the document
    • As each character is typed in the corresponding matching text is highlighted in the document.
    • Any text selected before the incremental search is start will become the first part of the searched for text.
    • If the string is not found an error message is displayed in the status bar.
    • Pressing the Backspace key removes the last character from the search string.
    • Pressing the Escape or Enter key stops the incremental search.
    • If the search text contains only lower case characters the search will be case insensitive.
    • If the search text contains an upper case character then the search is case sensitive.

    Searching Incrementally

    Position the cursor at the location where you want the search to start from.

    Enable the incremental search either by selecting the Incremental Search from the Search menu or by using the keyboard shortcut Ctrl+E.

    Incremental search menu item

    The mouse cursor over the text editor will then be changed to the Incremental Search icon Incremental search cursor to indicate that you have enabled the search.

    The status bar text will change to "Incremental Search".

    Incremental search enabled in text editor

    Type in a character and the first match below the current cursor position will be highlighted. The search text is also displayed in the status bar.

    Incremental search matching first character

    As you type in characters the search text is changed and matching text is highlighted. If the search text cannot be found the status bar text will show an error message.

    Search text not found

    The search is case insensitive if all the characters of the search text are lower case. If any character is upper case then the search will be case sensitive.

    If the first character typed in does not match anything below the cursor but can be found above the cursor position, at the start of the document, then the match will be highlighted and the status bar will show a warning message informing you that the end of the document has been passed. In the screenshot below the cursor was put at the end of the document and then the incremental search was started.

    Passed end of document warning message

    To stop the incremental search press the Escape or Enter key.

    Reverse Incremental Search

    The reverse incremental search will search from the current cursor position to the start of the document.

    Enable the reverse incremental search either by selecting the Reverse Incremental Search from the Search menu or by using the keyboard shortcut Ctrl+Shift+E.

    Reverse incremental search menu item

    The mouse cursor will then be changed to the Reverse Incremental Search icon Reverse incremental search cursor to indicate that you have enabled the search. The status bar text will also be changed to "Reverse Incremental Search".

    As you type a character the matching text will be highlighted and the search text will be shown in the status bar.

    To stop searching press the Escape or Enter key.

    Visual Studio Comparison

    The differences between the SharpDevelop's and Visual Studio's incremental search.

    FeatureSharpDevelopVisual Studio
    ShortcutsCtrl+E, Ctrl+Shift+ECtrl+I, Ctrl+Shift+I
    Case sensitive searchAn upper case character in the search string makes the search case sensitive.Select the Match case option in the Find dialog.
      Posted Sep 09 2006, 04:11 PM by MattWard with 12 comment(s)
      Filed under:
    • New WiX Installer for SharpDevelop 2.1

      Chris just announced in the forums that the build server is now up and running for SharpDevelop 2.1. This includes a new installer for SharpDevelop using WiX rather than NSIS. If there are any problems with this installer please report them in the forum.

      Installing

      The installer is now an MSI file and not an executable as it was previously. To install, download the MSI file and then double click it to install, or right click the file and select Install.

      If you install under an account with Administrator privileges SharpDevelop will be installed for All Users.

      You can install SharpDevelop under a non-privileged account, however the following things will not be done:

      • NGen is not run on SharpDevelop.exe.
      • NUnit is not installed in the GAC. Without this the Unit Testing window cannot be used.

      Uninstalling

      Open the Control Panel.

      Select Add or Remove Programs.

      Select SharpDevelop 2.1.

      Click the Remove button.

      Upgrading

      The new installer now supports upgrades and will upgrade an old SharpDevelop 2.1 if it finds one. To upgrade simply run the new installer without uninstalling the previous version of SharpDevelop.

      You cannot install an older version over the top of an existing installation (i.e. downgrade).

      You can install SharpDevelop 2 alongside SharpDevelop 2.1.

      What does the Installer do?

      • Installs the SharpDevelop files.
      • Adds a desktop shortcut to the SharpDevelop executable.
      • Adds program menu shortcuts for SharpDevelop and a link to the SharpDevelop website.
      • NGens the SharpDevelop executable (Admin only).
      • Installs NUnit into the GAC (Admin only).
      • Registers file associations for:
        • .booproj
        • .cmbx
        • .csproj
        • .prjx
        • .sdaddin
        • .sln
        • .vbproj
        • .wixproj
        • .xfrm

      Future Improvements

      The following improvements should hopefully be added to the installer at some point.

      • Optional file assocation with SharpDevelop.
      • Choose UI language.
      • Choose name of program group.
      • Option to install source code.
      • Check if optional components (e.g. FxCop, NCover) are installed and advise the user to install them to activate certain features inside SharpDevelop.
      Posted Sep 04 2006, 11:11 PM by MattWard with no comments
      Filed under: ,
    Powered by Community Server (Commercial Edition), by Telligent Systems
    Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.