次の方法で共有


How to: Create the Windows Installer Package for the Server

 

Applies To: Windows Server 2012 Essentials, Windows Home Server 2011, Windows Storage Server 2008 R2 Essentials, Windows Small Business Server 2011 Essentials

Note

Before you start the procedure in this section, you must complete the procedure listed in How to: Install the Windows Installer XML (WiX) Tools.

After you download and install the tools, you can use them to create the Windows Installer package (msi) files. An add-in can contain code that is installed on the server, on client computers, or on both the server and client computers.

Important

You must ensure that you know the deployment requirements for the type of add-in that you are packaging. You must also ensure that the Windows Installer package can be run silently.

For more information about creating and deploying add-ins, see the following sections:

The Deployment sample that is provided with the SDK is configured to install a new top-level tab, install an XML file that extends the home page on the server, and install the XML files that are used to extend the Launchpad on both a 32-bit client computer and a 64-bit client computer.

All add-ins must have a <Server>.msi file where <Server> is any name that you want as long as it has an .msi extension. The following procedure shows you how to create an .msi file that is used to install the code from the sample that runs on the server. The files that are installed by the <Server>.msi file must be installed in the 64-bit Program Files folder because of the 64-bit operating system.

To create the .msi file

  1. Open Notepad.

  2. Add the following XML code:

    <?xml version='1.0' encoding='windows-1252'?>  
    <Wix xmlns='https://schemas.microsoft.com/wix/2006/wi'>  
       <Product   
         Name='Sample Add-in Server Deployment'   
         Id='d21da776-86C7-4D14-AEC0-86416A69ABDE'   
         UpgradeCode='d21da776-7349-453F-94F6-BCB5110BA4FD'  
         Language='1033'   
         Codepage='1252'   
         Version='1.0.0'   
         Manufacturer='Your Company Name'>  
    
          <Package   
            Id='*'   
            Keywords='Installer'   
            Platform="x64"  
            Description=”Sample Deployment"  
            Comments='Sample Deployment of Server Add-ins'    
            Manufacturer='Your Company Name'  
            InstallerVersion='200'   
            Languages='1033'   
            Compressed='yes'   
            SummaryCodepage='1252' />  
    
          <Media   
            Id='1'   
            Cabinet='WSSSampleAddins.cab'   
            EmbedCab='yes'   
            DiskPrompt="CD-ROM #1" />  
    
          <Property Id='DiskPrompt' Value="Addins Installation [1]" />  
    
          <Directory Id='TARGETDIR' Name='SourceDir'>  
             <Directory Id='ProgramFiles64Folder' Name='PFiles'>  
                <Directory Id="AddinBinaryDir" Name="WSSAddinsBinaries">  
                   <Component   
                     Id='WSSTopLevelTabWPFSampleBinaryComponent'   
                     Guid='d21da776-83F1-4F22-985B-FDB3C8ABD481'   
                     Win64='yes'>  
                       <RemoveFolder Id='AddinBinaryDir' On='uninstall' />  
                       <File   
                         Id='WSSTopLevelTabWPFSampleBinary'   
                         Name='WSSTopLevelTabWPFSample.dll'   
                         DiskId='1'   
                         Source='binaries\WSSTopLevelTabWPFSample.dll'   
                         ProcessorArchitecture='x64'   
                         KeyPath='yes'>  
                       </File>  
                    </Component>  
                </Directory>  
    
                <Directory Id="WindowsServerDir" Name="Windows Server">  
                   <Directory Id="WindowsServerBinDir" Name="Bin">  
                      <Directory Id="WindowsServerAddinsDir" Name="Addins">  
                         <Directory Id="WindowsServerPrimaryDir" Name="Primary">  
                            <Component   
                              Id='WSSTopLevelTabWPFSampleXMLComponent'   
                              Guid='d21da776-83F1-4F22-985B-FDB3C8ABD491'   
                              Win64='yes'>  
                               <File Id='WSSTopLevelTabWPFSampleXML'   
                                 Name='WSSTopLevelTabWPFSample.addin'   
                                 DiskId='1'   
                                 Source='binaries\WSSTopLevelTabWPFSample.addin'   
                                 ProcessorArchitecture='x64'   
                                 KeyPath='yes'>  
                               </File>  
                            </Component>  
                         </Directory>  
    
                         <Directory Id="WindowsUpdateHomePageTaskDir" Name="Home">  
                            <Component   
                              Id='WindowsUpdateHomePageTaskComponent'   
                              Guid='d21da776-83F1-4F22-985B-FDB3C8ABD4A1'   
                              Win64='yes'>  
                               <File   
                                 Id='WindowsUpdateHomePageTask'   
                                 Name='WindowsUpdateHomePageTask.dll'   
                                 DiskId='1'   
                                 Source='binaries\WindowsUpdateHomePageTask.dll'   
                                 ProcessorArchitecture='x64'   
                                 KeyPath='yes'>  
                               </File>  
                            </Component>  
                         </Directory>  
                      </Directory>  
                   </Directory>  
                </Directory>  
             </Directory>  
          </Directory>  
    
          <Feature Id='Complete' Level='1'>  
             <ComponentRef Id='WSSTopLevelTabWPFSampleBinaryComponent' />  
             <ComponentRef Id='WSSTopLevelTabWPFSampleXMLComponent' />  
             <ComponentRef Id='WindowsUpdateHomePageTaskComponent' />  
          </Feature>  
    
       </Product>  
    </Wix>  
    

    Note

    • Each Id attribute and Guid attribute for the components must be unique.
    • The Name attribute of the File element is the name of the file that is copied to the specified folder on the target computer.
    • The Source attribute of the File element is the relative path to the file.
    • To install the files in the Program Files folder instead of the Program Files (x86) folder, the Platform attribute of the Package element must be specified to be x64, and the InstalledVersion attribute must be at least 200. All the Component elements must have the Win64 attribute set to yes and all the File elements must have ProcessorArchitecture attribute set to x64.
  3. Save the file as SampleWSSServerDeployment.wxs. When developing .msi files other than the sample, you can provide any name, but the file must have a .wxs extension.

  4. Create the .wixobj file from the file that you created in the previous step by using the Candle tool from the WiX toolset. Open a command-prompt window and type the following command followed by Enter:

    candle.exe SampleWSSServerDeployment.wxs

  5. Create the .msi file from the .wixobj file by running the Light tool from the WiX toolset. In the command-prompt window, type the following command followed by Enter:

    light.exe -ext WixUIExtension SampleWSSServerDeployment.wixobj

To test the Windows Installer package, you can run it by double clicking the .msi file, verify that the files were copied to the appropriate places, and then you can remove the package. The package can be removed by uninstalling it from the Control Panel.

Note

The components of the add-in are installed from separate .msi files for the server and the client computers. For more information about installing components for client computers, see How to: Create the Windows Installer Package for 32-bit Client Computers or How to: Create the Windows Installer Package for 64-bit Client Computers.