Export (0) Print
Expand All
Expand Minimize
3 out of 5 rated this helpful - Rate this topic

Adding Lync 2010 SDK Runtime Assembly to an Application Installation Program

Summary:   This article describes how to create an executable program that installs the MSDNArticleIM sample application. The MSDNArticleIM setup.exe file installs the Microsoft Lync 2010 SDK runtime as a prerequisite. After the prerequisite is installed, the MSDNArticleIM application is installed.

Applies to:   Microsoft Lync 2010 SDK | Microsoft Lync 2010 API

Published:   May 2011 | Provided by:   John Austin, Microsoft | About the Author

Contents

Code Gallery  Download code

An application that references Microsoft Lync 2010 API must install Microsoft.Office.Uc.dll before run time. To ensure that the Lync 2010 API runtime DLL is installed before a user starts the application, you can create a custom setup executable program that combines multiple dependent installation programs in one setup executable program.

Before you install a Lync 2010 API runtime DLL, you must install the Microsoft Lync 2010 SDK LyncSDKRedist.msi. Microsoft Software License Terms are specified in LyncSDKRedist.msi. After LyncSDKRedist.msi is installed, the setup executable program can install the runtime DLLs.

In this article, the MSDNArticleIM application shows how to develop an installation program that installs LyncSDKRedist.msi, Microsoft.Office.Uc.dll, and Microsoft.Lync.Model.dll. The LyncSDKRedist.msi file is chained with the default Visual Studio setup .msi file.

The following sections describe how to add the MSDNArticleIM installation program to a Microsoft Visual Studio development system solution, and then create a dependency on LyncSDKRedist.msi so that the MSDNArticleIM setup.exe file installs the Microsoft Lync 2010 SDK runtime before the application is installed.

Deployment Project Prerequisites

To create a deployment project that resembles the Visual Studio project that is used to create the MSDNArticleIM application, the following software is required.

  • Microsoft Visual Studio 2008 or Microsoft Visual Studio 2010 development system.

  • Microsoft Lync 2010 SDK.

  • Microsoft Lync 2010 API Runtime DLLs.

A Lync 2010 API-based application requires two Lync SDK assemblies. Microsoft.Lync.Model.dll is added to Visual Studio project references to give you access to the members of the Microsoft Lync 2010 namespaces. Microsoft.Office.Uc.dll must be available to the application process at run time. To ensure that the users of the application install Microsoft.Office.Uc.dll, you should create a setup.exe file that installs both Microsoft.Office.Uc.dll and the application.

You should create a license terms file as either an .rtf file or .txt file as a component of the setup .msi file. The main purpose of the license terms file is to present conditions for the use of the intellectual property represented by the application. In addition, the license terms must comply with the conditions that you agree to when you accept the Lync SDK license terms. The license terms are added to the deployment project.

To ensure that the application is updated with current redistributable files, the LyncSdkRedist.msi file is chained to the setup .msi file that is located in the Visual Studio project. To chain the two .msi files, create a bootstrapper setup package for LyncSdkRedist.msi and then add it to the Setup program prerequisites. For information about how to add a prerequisite, see Creating Bootstrapper Packages.

TipTip

The bootstrap package can also be used for a ClickOnce deployment application.

To Create a Deployment Project

  1. In Visual Studio, right-click the solution file in Solution Explorer and then click Add New Project. The Add New Project dialog box appears.

  2. In the Add New Project dialog box, select the Other Project Types template. The Other Project Types template appears in the Installed Templates area.

  3. In the Other Project Types area, select Setup and Deployment, and then select Visual Studio Installer.

  4. In the Visual Studio Installer area, select Setup Wizard.

  5. In Setup Wizard (2 of 5), select Create a setup for Windows application.

  6. In Setup Wizard (3 of 5), select the Primary output fromyour solution name option.

  7. In Setup Wizard (4 of 5), add your license agreement.

The Setup Wizard creates a setup project that is added to the Visual Studio solution. For information about how to modify the prerequisite properties of the setup project file to include the bootstrap package that is created in the next section, see Configuring the Deployment Project Properties.

The MSDNArticleIM solution hierarchy appears in Figure 1. The MSDNArticleIM project contains the MSDNArticleIM source code. MSDNArticleIM_ is the deployment project that chains LyncSDKRedist.msi with the default Visual Studio setup .msi file, and then installs Microsoft.Office.Uc.dll.

Figure 1. MSDNArticleIM solution

MSDNArticleIM solution

For more information, see How to: Create or add a Deployment Project.

Creating a Bootstrap Package

Before you can designate the Lync SDK runtime as a prerequisite of an application, you must create a bootstrapper package for the deployment project. The following table lists the files that are included in a bootstrapper package.

File name

Description

Product.xml

Describes the LyncSdkRedist.msi and is not localized.

LyncSdkRedist.msi

The Lync 2010 SDK runtime installation program that is called by the default Visual Studio setup .msi file.

Package.xml

Contains localized error messages that appear during installation.

ContosoLicenseTerms.rtf

MSDNArticleIM license terms. After reviewing and accepting the license terms, the user can install the MSDNArticleIM application.

To create a bootstrap package

  1. Open Microsoft Windows Explorer and then browse to %ProgramFiles%\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages.

  2. In the Packages folder, create a new folder that is named Lync2010SDK. This example uses %ProgramFiles%\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\Lync2010SDK.

  3. In the Lync2010SDK folder, create a new XML document that is named product.xml.

  4. Copy the XML that appears in the next code example to the product.xml file, and then save product.xml.

  5. Copy the LyncSdkRedist.msi file from the %ProgramFiles%\Microsoft Lync\SDK\Redist folder to the Lync2010SDK folder.

  6. In the Lync2010SDK folder, create a new folder that is named En. Save package.xml in the En folder. If package.xml is translated to another language, you must create a new folder for each localized version.

For more information about how to create a bootstrap package, see How to: Create a Product Manifest.

Product XML

The product.xml XML appears in the next example. The MsiProductCheck property attribute value is identical to the LyncSdkRedist.msi revision number that appears in Figure 2.

<?xml version="1.0" encoding="utf-8" ?>
<Product
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  ProductCode="Custom.Bootstrapper.Package">

  <RelatedProducts>
    <DependsOnProduct Code="Microsoft.Windows.Installer.3.1" />
  </RelatedProducts>

  <PackageFiles>
    <PackageFile Name="LyncSdkRedist.msi"/>
  </PackageFiles>

  <InstallChecks>
    <MsiProductCheck Product="IsMsiInstalled"
      Property="{364DDCC9-8181-4149-91EF-4E20384171B8}"/>
  </InstallChecks>

  <Commands>
    <Command PackageFile="LyncSdkRedist.msi" Arguments="">

      <InstallConditions>
        <BypassIf Property="IsMsiInstalled"
          Compare="ValueGreaterThan" Value="0"/>
        <FailIf Property="AdminUser"
          Compare="ValueNotEqualTo" Value="True"
         String="NotAnAdmin"/>
      </InstallConditions>

      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="1641" Result="SuccessReboot"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" String="GeneralFailure"/>
      </ExitCodes>
    </Command>
  </Commands>
</Product>

Microsoft Windows Installer compares the revision number value that appears in Figure 2 and the revision number that is used in previously installed versions of the Lync SDK runtime. If the value matches a previously installed revision, the runtime dependency is not installed.

Figure 2. LyncSdkRedist.msi Details tab

LyncSdkRedist.msi Details tab

Package XML

The package.xml XML that is used during the installation process for the MSDNArticleIM application appears in the next example.

After the following two values are updated with ContosoLicenseTerms.rtf, a license terms agreement appears. After accepting the license terms, the application is installed.

  • LicenseAgreement="ContosoLicenseTerms.rtf

  • <PackageFile Name="ContosoLicenseTerms.rtf"/

Important noteImportant

The license terms agreement dialog box should appear before the first prerequisite is installed. If the license terms agreement appears after the prerequisites are installed and the user rejects the license terms, the application is not installed. However, the Lync SDK runtime is installed.

<?xml version="1.0" encoding="utf-8" ?>
<Package
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  Name="DisplayName"
  Culture="Culture"
  LicenseAgreement="ContosoLicenseTerms.rtf">

    <PackageFiles>
        <PackageFile Name="ContosoLicenseTerms.rtf"/>
    </PackageFiles>
    <!-- Defines a localizable string table for error messages-->
    <Strings>
        <String Name="DisplayName">Microsoft Lync 2010 SDK Redistributable</String>
        <String Name="Culture">en</String>
        <String Name="AdminRequired">Administrator permissions are required to install the Contoso Custom IM Application. Contact your administrator.</String>
        <String Name="DotNetFxRequired">Installation of Contoso Custom IM Application and Microsoft Lync 2010 SDK Runtime requires Microsoft .NET Framework 3.5. Contact your application vendor.</String>
        <String Name="WindowsInstallerImproperInstall">Due to an error with Windows Installer, the installation of Contoso Custom IM Application cannot proceed.</String>
        <String Name="AnotherInstanceRunning">Another instance of setup is already running. The running instance must end before this setup can proceed.</String>
        <String Name="BetaProductFailure">A beta version of Contoso Custom IM Application was detected on the computer. Uninstall any previous beta versions of Contoso Custom IM Application before continuing.</String>
        <String Name="GeneralFailure">A failure occurred attempting to install Contoso Custom IM Application.</String>
    </Strings>
</Package>

Configuring the Deployment Project Properties

Deployment project properties are configured in Solution Explorer. The Microsoft Lync 2010 SDK Redistributable bootstrap package that is created in the previous procedure is configured in the MSDNArticleIM_ Property Pages dialog box.

Figure 3. MSDNArticleIM_ Property Pages dialog box

MSDNArticleIM_ Property Pages dialog box

To configure the deployment project properties

  1. In Visual Studio, open Solution Explorer and then right-click the deployment project. The MSDNArticleIM_ Property Pages dialog box appears.

  2. In the MSDNArticleIM_ Property Pages dialog box, click Prerequisites. The Prerequisites dialog box appears.

    Figure 4. Bootstrap program prerequisites

    Bootstrap program prerequisites
  3. To add the bootstrap package dependency, in the Prerequisites dialog box, select Microsoft Lync 2010 SDK Redistributable.

  4. In the Prerequisites dialog box, select Create Setup program to install prerequisite components, and then click OK.

    NoteNote

    By default, the Microsoft .NET Framework 4 Client Profile (x86 and x64) option and the Download prerequisites from the component vendor’s web site option is selected automatically. The Microsoft .NET Framework 4 Client Profile (x86 and x64) option is based on the application target framework that is selected for the application.

For more information, see How to: Install Prerequisites in Windows Installer Deployment.

Use File System Editor in Visual Studio to set the installation location for the application executable program file and the application support files. File System Editor is used to set the location of the MSDNArticleIM installation executable program file, runtime assemblies, Help documentation, and license agreement. In addition, File System Editor is used to add shortcuts to the Help documentation and the application executable program file.

To access File System Editor, right-click the setup project in Solution Explorer, point to View, and then click File System.

For more information about how to use File System Editor, see File Installation Management in Deployment.

Configuring the Application Folder

The application folder is used to manage file installation properties. The following application files are managed in the application folder.

  • Setup.exe file.

  • Help files.

  • Application Start menu folders.

  • Shortcuts to the application and Help files.

To configure the Application Folder

  1. In File System Editor, right-click Application Folder and then click Properties. The Properties dialog box appears.

  2. In the DefaultLocation area, replace [Manufacturer] with the name of your company.

    The Properties dialog box for the MSDNArticleIM application appears in Figure 5. By default, the Application Folder value is set to [ProgramFilesFolder][Manufacturer]\[ProductName]. The values enclosed by brackets are application folder attribute values. On a Microsoft Windows-based computer, the application folder values resolve to %ProgramFiles%\Microsoft\MSDNArticleIM.

    Figure 5. Properties dialog box

    Application Folder properties
  3. In File System Editor, click the Application Folder.

  4. In the right pane of File System Editor, right-click an empty area of the pane, point to Add, and then click Project Output. The Add Project Output Group dialog box appears.

  5. In the Add Project Output Group dialog box, select Primary output.

  6. In the right pane of File System Editor, right-click an empty area of the pane, point to Add, and then click File. The Add Files dialog box appears.

  7. In the Add Files dialog box, select the license terms document.

In Figure 6, Primary output from MSDNArticleIM specifies the executable program file that is built from the Visual Studio application project.

NoteNote

The Setup Wizard adds the Microsoft.Lync.Model.dll and the Microsoft.Office.Uc.Dll to the MSDNArticleIM folder.

Figure 6. Deployment application installation folders

Deployment application installation

To add a Help folder to the Application Folder

  1. In File System Editor, right-click Application Folder, click Add, and then click Folder to create a new folder for Help documentation.

  2. In the File System Editor, click the Help folder that is created in step 1.

  3. In the right pane of File System Editor, right-click an empty area of the pane, point to Add, and then click File. The Add Files dialog box appears.

  4. In the Add Files dialog box, select the Help document for the application.

    In Figure 7, the MSDNArticleIM setup.exe file creates a Help folder and installs a Help document in the new folder.

    Figure 7. Deployment application installation Help folder

    Deployment application installation help folder

Creating Application Shortcuts

To simplify access to MSDNArticleIM, two shortcuts are added to a new folder on the Start menu. One shortcut points to MSDNArticleIM.exe, and the second shortcut points to the Help file.

To create application shortcuts

  1. In File System Editor, right-click User’s Programs Menu, click Add, and then click Folder.

  2. In the new shortcut folder entry, type the name of the application.

  3. In the right pane of File System Editor, right-click an empty area of the pane, and then click Create New Shortcut. The Select Item in Project dialog box appears.

    Figure 8. Select Item in Project dialog box

    Select Item in Project dialog box
  4. In the Select Item in Project dialog box, select the Help folder from the Look in combo box.

  5. In Select Item in Project, choose the application Help file.

  6. Point to the right side of the editor and then right-click an empty area of the pane. A shortcut menu appears.

  7. On the shortcut menu, point to Create New Shortcut. The Select Item in Project dialog box appears.

  8. In the Select Item in Project dialog box, select Application Folder from the Look in combo box.

  9. In Select Item in Project, choose the Primary output from MSDNArticleIM (Active) file.

  10. Rename the shortcut to your application name.

Figure 9 shows two shortcuts that are added to the MSDNArticleIM folder. The first shortcut points to the Help documentation, and the second shortcut points to the installed application.

Figure 9. Deployment folders

Deployment folders

Building the Deployment Project

The Visual Studio deployment project build process creates the following two folders. After you build the deployment project, you can distribute the contents of the Release folder.

  • The Package folder includes a copy of the bootstrap package that was created earlier in this article.

  • The Release folder includes a copy of the setup.exe file, the application .msi file, and the Lync SDK runtime .msi file.

This article describes how to create a setup.exe program file that installs the MSDNArticleIM application and three Microsoft Lync 2010 SDK runtime files. The MSDNArticleIM setup.exe file installs the following Lync SDK runtime files.

  • LyncSDKRedist.msi

  • Microsoft.Office.Uc.dll

  • Microsoft.Lync.Model.dll

The LyncSDKRedist.msi file is chained with the default Visual Studio setup .msi file. After the Lync SDK runtime dependency is installed, other dependencies such as Microsoft .NET Framework are installed, and then the application is installed.

John Austin, Microsoft, is a programmer/writer in the Lync client SDK documentation team. He has been writing technical documentation for four years. Prior to working for Microsoft, John spent two decades as a software developer.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.