ISWIX, LLC View Christopher Painter's profile on LinkedIn profile for Christopher Painter at Stack Overflow, Q&A for professional and enthusiast programmers

Thursday, April 5, 2007

TFS Build Automation Part 3 - InstallShield Build

Remember that TeamBuildTypes are VS2005 Solution centric. Fortunatly InstallShield comes with VS2005 and MSBuild integration right out of the box. When you add an InstallShield ( .ISM ) project to a VS2005 solution it automatically wires up a .ISPROJ file and some source control binding files.

The purpose of the .ISPROJ file is to teach the solution how to process the project using MSBuild. Using stanard VS2005 patterns such as Configuration Manager, TeamBuild simply builds the project completly unaware of the fact that it's using InstallShield to build one of the projects inside the solution.

In our previous article I mentioned the `LATEST` pattern. Since the binaries needed to be consumed into the Windows Installer database are in a seperate solution, we need to bring them into scope. We do that using MSBuild ItemCollections and CopyTasks like this:

<ItemGroup>
<MySourceFiles Include="$(LATEST)\**\*.*" />
</ItemGroup>

<Target Name="CopyFiles">
<Copy SourceFiles="@(MySourceFiles)" DestinationFiles="@(MySourceFiles->'$(SolutionRoot)\ProgramFilesFolder\MyCompanyName\MyProductName\\%(RecursiveDir)%(Filename)%(Extension)')"/>
</Target>

So now the WorkspaceMappings.xml brings the InstallShield files into scope and this CopyFiles tasks gets us our binaries from the previous build output. The result is ( assuming proper Windows Installer design of the InstallShield Wizard ) is 100% ready to perform a minor upgrade of just those component keyfiles that were rebuilt and branded with a newer version number.

Obviously I've not provided an entire sample solution showing all of the integration points. Hopefully I've not overlooked any so feel free to leave a comment if your getting stuck wiring up your new TFS based incremental, versioned build automation.

8 comments:

  1. Hi Christopher. I see your aproach to integrating Team Build with Installshield is very interesting. I'm trying a similar aproach, as I cannot bind my InstallShield project to the TFS Source Control folder. So what I'd like to do is to, somehow, start the InstallShield project build process from my TFSBuild.proj file msbuild tasks.

    Is there any way to do this?

    Thanks,
    Julio

    ReplyDelete
  2. When I first started putting all this together I thought that I would just skip the InstallShield MSBUILD task and use an Exec element to call out to issabld.

    However in the end I decided it was better to stay solution centric and use the Macrovision provided integratio points.

    My TFSBuild.proj (which contains build specific properties and item groups ) imports a project that I wrote called build_install.config ( which is the data driven static build harness). Build Install TFSBuild.proj imports Microsoft.TeamFoundation.Build.targets and 2 custom tasks that I wrote. The first task is a custom verion # pattern and the second is a task that knows how to brand an installshield source project with the correct version number.

    This harness calls a standard solution build which in turn calls the ISPROJ. The following targets are overriden:

    BuildNumberOverrideTarget - custom version number pattern

    BeforeClean - clean up $(BinariesRoot)

    BeforeCompile - Exec Attrib to make ISM writable. Call custom task to version ISM.

    AfterDropBuild - custom LATEST pattern. copy $(BinariesRoot) to LATEST folder.

    My solution file contains the ISM via a static ISPROJ file that brings in the $(MSBuildExtensionsPath)\Macrovision\IS12\Macrovision.InstallShield.targets.

    The SLN configuration manager has an active solution configuration called RELEASE that points to an InstallShield release called RELEASE. Product Configuration 1 is my only product configuration and is picked as the default behavior.

    While this doesn't really answer your question of how to skip the VS integration, I hope it shows enough of how it all comes together to use the integration.

    Personally I only use the integration for my build automation. Is VS I check the ISM out and go explorer and open it up outside of the IDE. This is just because I'm old school and don't like the way the integrated IDE looks.

    ReplyDelete
  3. Your post says the isproj file is generated when you add the project to source control. I assume this means when you add it to source control through the InstallShield application (Tools -> Source Control). Do you know how to enable this menu? It is completely disabled for me and I am having trouble finding a reference on how to get it working.

    ReplyDelete
  4. Actually I said it gets created when you add the ISM as a project to your solution in Visual Studio.

    Using it this way, you do your checkout using team explorer either manually or automatically via source control bindings.

    If you are trying to use source control options in InstallShield ( outside of Visual Studio ) then you'll need to download the MSSCCI provider for your particular source control tool. TFS has one available, just google for "TFS MSSCCI"

    ReplyDelete
  5. Chris, You have been a tremendous asset for a lot of Installshield Issues I had been having. I had people at the VSTS Live conference in Orlando direct me to your blog.

    My issue I am trying to integrate an existing .ISM I created on my local desktop with TFS Build. I created a folder below my project folder and checked in MY.ism . I have IS Standalone on my TFS Build Server.

    How do I add that .ISM to my .sln file and will it create a .ISPROJ file for me ?

    Do I need this is my tfs.proj file as well:
    Package Include="Daytona_Services2.ism"
    PackagerType=IS
    SetupProjFolder
    etc..

    Any insight aprreciated. I cannot find this well documented anywhere.

    TX.
    Randy Kibbe

    ReplyDelete
  6. I haven't looked at this in awhile, but I once contributed an example to InstallSite. It can be found here at:

    http://www.installsite.org/pages/en/msi/isd.htm

    If you email me I can send you some more current files that use IS2009 and TFS 2008.

    ReplyDelete
  7. Chris,

    I had come across your example. I was able to compile with it. I wasn't sure how the .ISPROJ file was created and how to add the .isproj reference to the .sln file.

    If you have more examples you can send me. I would greatly appreciate it.
    My email: randy_kibbe@picis.com
    Thanks

    ReplyDelete
  8. Hi Christopher,
    I'm trying to integrate Installshield 2009 basic msi project into a.net solution, and calling that solution from TFS build.
    The steps I followed were:
    1.I opened a new Windows application project(the path is where my existing Installshield project resides), it automatically creates the solution.
    2.right click the solution, and add the existing Project.(Is proj file has been created
    3. i could successfully build the solution with no errors.
    4.I copied this whole folder to the test machiene, where TFS test server is and add this folder to the TFS.
    5.Created new TFS project and a new build type. Called the solution what ever I have created from this build type.
    6. When I run this build, I'm getting no errors or no warnings. build was successful.
    7. I could see Target CoreCompile:
    Skipping target "CoreCompile" because it has no outputs.
    8. Could not see the traces of .ism or isproj files are being built

    ReplyDelete