November 16, 2011

How to Reset the Edit control value on CheckBox Action?

This article explains how to reset the Edit control value on CheckBox Action.

Assume you have two Edit controls named EDIT1 & EDIT2 and a Check Box named ChkBoxSkip.
OnClick on ChkBoxSkip, you may want to set null value or empty string to EDIT1 & EDIT2 and disable them. Technically you should be able to define SetProperty CustomActions and add them under ChkBoxSkip events. But due to current limitation in InstallShield, it does not work this way.

Workaround:
Create two additional Edit controls named EDIT1_1 & EDIT2_2 and disable them by default. The default value of ChkBoxSkip should be set to 1 and there is no need to create IS_SKIP_CHECKED property in the Property Manager.
The properties associated to these controls are defined in below table
Control
Property
EDIT1
USERNAME
EDIT2
EMAILID
EDIT1_1
DUMMY
EDIT2_2
DUMMY
ChkBoxSkip
IS_SKIP_CHECKED
Now you will have to display EDIT1 & EDIT2 controls when ChkBoxSkip is UNCHECKED and display EDIT1_1 & EDIT2_2 when ChkBoxSkip is CHECKED. To achieve this, set the following contions for each of the Edit Controls.
 
Control
Action
Condition
EDIT1
Hide
SKIP_CHECKED
Show
Not  SKIP_CHECKED 
Enable
Not  SKIP_CHECKED
EDIT2
Hide
SKIP_CHECKED
Show
Not  SKIP_CHECKED 
Enable
Not  SKIP_CHECKED
EDIT1_1
Hide
Not SKIP_CHECKED
Show
SKIP_CHECKED 
EDIT2_2
Hide
Not SKIP_CHECKED
Show
SKIP_CHECKED 
 











with this, from the user's perspective EDIT1 & EDIT2 will be enabled with ChkBoxSkip is UNCHECKED and disabled & cleared when ChkBoxSkip is CHECKED. But actually the Property associated with EDIT1 and EDIT2 can be reset by using SetProperty CA OnClick on Next button.

Note: Applies to Basic MSI Project and verified in InstallShield 2012.

October 27, 2011

How to setup Build Automation for .Net Projects on Windows 2008 Standard R2 - 64bit?

Installing Cruise Control.Net & NAnt and setting up the Build Automation for .Net projects is pretty straight forward on a Windows Server 2003 but extra care should be taken while configuring it on Locked Down environments like Windows 2008 R2 Server.

Here you go with few simple steps

  1. Install IIS using "Add Roles"
  2. Install Visual Studio 2010 (or the version required for your .Net Application)
  3. Download and Install Cruise Control.Net version 1.6.7981.1. By default it goes to "C:\Program Files (x86)\CruiseControl.NET"
  4. If you are attempting to use a domain account (say domain\user1) for CruiseControl.Net, then start "CruiseControl.NET Server" from Windows Services panel using the 'user1' account and grant full control to same user for the C:\Program Files (x86)\CruiseControl.NET folder 
  5. Download and extract apropriate version on NAnt to C:\Program files (x86) path.
    Also add C:\Program Files (x86)\NAnt\bin path to the PATH environment variable to access NAnt from the command line.
These settings should work for just compiling the Project source but if you are aiming to get the product source from source control management (SCM) tool and build the installer as well, then you need to install SCM tools (say TFS) and Installer compiler (say Stand Alone Builder in case of InstallShield)

October 14, 2011

Rollback in TFS 2010

Rollback or Undo a particular changeset is always something that comes your way to quickly revert the changes that has gone into the source control.
Though TFS 2010 have command line options (say tf rollback /?) but a GUI can always be handy.
August 2011 update on TFS 2010 Power Tools have a solution to the long waited "GUI for Rollback"

Click here for more details on Rollback in TFS  and you can download and install TFS 2010 Power Tools (along with Team Explorer).
After installing TFS 2010 Power Tools, you will have Rollback context-menu by right clicking the branch or the changeset in the history.

September 16, 2011

NAnt - Surround SCM Tasks from NAnt Contrib

sscmget -- Gets files from a Surround SCM repository.

Usage:   Get all files and repositories from repository 'Mainline/Widget' recursively from the 'Widget 1.0' branch to the working directory setup for user 'administrator'. This call forces the file retrieval from the server even if the local file is current and overwrites any local files that are writable with the server copy.
<sscmget
    serverconnect="localhost:4900"
    serverlogin="administrator:"
    file="/"
    branch="Widget 1.0"
    repository="Mainline/Widget"
   recursive="true"
    force="true"
    overwrite="true"
/>
Source: http://nantcontrib.sourceforge.net/release/0.85/help/tasks/sscmget.html

sscmlabel -- Creates file or repository labels for a Surround SCM repository.

Usage: Label version 4 of the file 'Mainline/Widget/Widget.java' in the 'Widget 1.0' branch with 'Release 1.0.1' and the given comment. An existing 'Release 1.0.1' label on this file to be moved to version 4 of the file.
<sscmlabel
    serverconnect="localhost:4900"
    serverlogin="administrator:"
    branch="Widget 1.0"
    repository="Mainline/Widget"
    file="readme.txt"
    label="Release 1.0.1"
    overwritelabel=" true"
     comment=" This labels the final build for the release of Widget 1.0.1."
    version=" 4"
/>
Source: http://nantcontrib.sourceforge.net/release/0.85/help/tasks/sscmlabel.html

 sscmcheckin -- Checks in files in Surround SCM repository.

Usage: Check in file 'Mainline/Widget/Widget.java' from the 'Widget 1.0' branch from the working directory setup for user 'administrator' with comment 'I made some changes'. Set the 'Release 1.1.1' label to this new version, even if the label already exists on an earlier version.
<sscmcheckin
    serverconnect="localhost:4900"
    serverlogin="administrator:"
    file="Widget.java"
    branch="Widget 1.0"
    repository="Mainline/Widget"
    comment="I made some changes"
    label="Release 1.1.1"
    overwritelabel="true"
/>
Source: http://nantcontrib.sourceforge.net/release/0.85/help/tasks/sscmcheckin.html

sscmcheckout -- Checks out files from a Surround SCM repository.

Usage:   Check Out version 1 of the file 'Mainline/Widget/Widget.java' exclusively from the 'Widget 1.0' branch to the working directory setup for user 'administrator'. Writable local files are not overwritten, even if they are out of date.
<sscmcheckout
    serverconnect="localhost:4900"
    serverlogin="administrator:"
    quiet="true"
    file="Widget.java"
    branch="Widget 1.0"
    repository="Mainline/Widget"
    overwrite="false"
    writable="true"
    version="1"
    exclusive="true"
/>
Source: http://nantcontrib.sourceforge.net/release/0.85/help/tasks/sscmcheckout.html
 
In addition there are 2 more tasks for Surround SCM sscmfreeze and sscmunfreeze.
 Note: that All the task in this section are provided by NAnt contrib
 

NAnt - Some userful Tasks


1) xmlpeek -- Extracts text from an XML file at the location specified by an XPath expression

Usage: xml file used is for the given example is
<? xml version="1.0" encoding="utf-8”?>
<configuration xmlns="http://www.gordic.cz/shared/project-config/v_1.0.0.0">
    <appSettings>
        <add key="server" value="testhost.somecompany.com" />
    </appSettings>
</configuration>

Using xmlpeek to extract the value of add node where key =’server’

<xmlpeek
    file="App.config"
    xpath="/x:configuration/x:appSettings/x:add[@key ='server']/@value"
    property="configuration.server">
        <namespaces>
<namespace prefix="x" uri="http://www.gordic.cz/shared/project-config/v_1.0.0.0" />
        </namespaces>
</xmlpeek>


2) xmlpoke -- Replaces text in an XML file at the location specified by an XPath expression.

Usage: the xml file is same as above

Xmlpoke will change the value of the value property of add to the value provided which is productionhost.somecompany.com

<xmlpoke
    file="App.config"
    xpath="/configuration/appSettings/add[@key = 'server']/@value"
    value="productionhost.somecompany.com" />

3) asminfo -- Generates an AssemblyInfo.cs file using the attributes given.

Usage: 
<asminfo output="AssemblyInfo.cs" language="CSharp">
    <imports>
        <import namespace="System" />
        <import namespace="System.Reflection" />
        <import namespace="System.EnterpriseServices" />
        <import namespace="System.Runtime.InteropServices" />
    </imports>
    <attributes>
        <attribute type="ComVisibleAttribute" value="false" />
        <attribute type="CLSCompliantAttribute" value="true" />
        <attribute type="AssemblyVersionAttribute" value="1.0.0.0" />
<attribute type="AssemblyTitleAttribute" value="My fun assembly" />
<attribute type="AssemblyDescriptionAttribute" value="More fun than a barrel of monkeys" />
<attribute type="AssemblyCopyrightAttribute" value="Copyright (c) 2002, Monkeyboy, Inc." />
<attribute type="ApplicationNameAttribute" value="FunAssembly" />
    </attributes>
    <references>
        <include name="System.EnterpriseServices.dll" />
    </references>
</asminfo>

Here an AssemblyInfo.cs file is created with metadata information as provided in the attribute element of asminfo tag. The import element is used to import some namespaces in the AssemblyInfo.cs file. However reference section can be omitted as per the requirements

4) foreach -- Loops over a set of items.

Usage:  Loops over all files in the project directory.
<foreach item="File" property="filename">
    <in>
        <items>
            <include name="**" />
        </items>
    </in>
    <do>
        <echo message="${filename}" />
    </do>
</foreach>
    
Each item which it is currently looping the string value of it can be stored in ‘property’ property of the foreach tag. It can be very useful for some special requirements. Other use of this task is mentioned in the Link mentioned below.


5) scripts -- Executes the code contained within the task. This code can include custom extension function definitions. Once the script task has executed those custom functions will be available for use in the build file.

Usage: 
<script language="C#" prefix="test" >
     <code>
         <![CDATA[
              [Function("test-func")]
              public static string Testfunc(  ) {
                  return "some result !!!!!!!!";
              }
         ]]>
     </code>
</script>
<echo message='${test::test-func()}'/>

The various scripts which can be used are VB, C#, JS, JSHARP.
The reuse of the function in the NAnt script is also shown.



6) choose(NAnt contrib) : Executes an alternate set of tasks depending on conditions that are individually set on each group of tasks. Similar to if- else if.

Usage: 
<choose>
    <when test="${build.config == 'Debug'}">
        <!-- compile app in debug configuration -->
        ...
    </when>
    <when test="${build.config == 'Release'}">
        <!-- compile app in release configuration -->
        ...
    </when>
    <otherwise>
<fail>Build configuration '${build.config}' is not supported!</fail>
    </otherwise>
</choose>

Source: http://nantcontrib.sourceforge.net/release/0.85/help/tasks/choose.html

September 9, 2011

Using Radio button in InstallShield – Simplified

This article explains about adding two Radio buttons to a Radio group and setting / reading the option's value in a VBScript Custom Action.
[Note: The steps are based on Basic MSI Project using InstallShield 2011].
·         Create a Radio Group in a Custom dialog and name the property as RADIOGROUPVAR.
·         Add two radio buttons (with text Yes & No) to the Radio Group and define ‘order’ & ‘value’ properties of the radio button as detailed below

Radio Button
Order
Value
Yes
2
Yes
No
1
No

In this example, Order is set to 1 for ‘No’ radio button and hence it will be selected by default.
·         Further set the value of ‘RADIOGROUPVAR’ in Property Manager as No, to ensure that ‘No’ radio button is selected by default.
So now the UI Design is done.
·         Set / Read the radio button value through VB Script Custom Action
o   Set
Session.Property(“RADIOGROUPVAR”)=”No”
o   Read
MSGBOX “RADIOGROUPVAR Value =>“  &  Session.Property(“RADIOGROUPVAR”)

August 15, 2011

More about Upgrades

A great challenge that the Application Packaging team faces during the installer development is to make decision about how are we going to distribute future releases to customers? It depends on various factors like
  • How big is the installation?
  • What will be the impact if your customer has to reinstall the product? For example re-installation will have an adverse effect on realtime applications with huge database.
  • Frequency of upgrades to be released
Here is what Shieldmaster have compiled on Upgrade Strategy, which will help to address Customer's concern by choosing appropriate Upgrade technique.

InstallTalk's recommendations on when to use major or minor upgrades

If you would like to have a single installer with support for seamless, which should not to disturb existing installation during upgrade and for new customers the same should behave like a fresh installation, then minor upgrade is your choice. Here is the Step by Step approach to create minor upgrade.

July 16, 2011

Did you know that Low disc space can also result in CCNet Exception?

The CruiseContrl.Net users might have encountered Exceptions on various reasons like session timeout etc. but very recently I have observed that one of the build resulted in the following exception, when there is low disc space.
"There was an exception trying to carry out your request."

Exception Message
Unable to execute transform: C:\Program Files\CruiseControl.NET\webdashboard\xsl\header.xsl

The subsequent builds successed after freeing up required disc space.
Note: This was verified in CruiseControl.Net  v1.5.7217.6