zoukankan      html  css  js  c++  java
  • Community Server Installer using WiX Part 1

    http://codeblooded.com/blog/archive/2004/10/03/154.aspx

     

    For those that don't know I've been working on the ASP.NET Forums codebase for a long time and I've always wanted to have a MSI based installer but with my full time job and the work that needed to be done with getting the Forums software up and running, I never had time.

    Now that I've been hired on with Telligent Systems I can now make the time to rework the Forums installer to use MSI and to do that I'm going to use WiX.

    Since using WiX to create the installer for the Forums software is going to be a learning experience and I'll also learn some information that will help me when I have the time to get back to work on WiXStudio I thought I would document the process that I'm going through and the leasons learned in creating a WiX file.

    Before I get started I want to give a little background on the Forums software and some goals that I'll want to have met before I'll be satisfied with the installer.


    Goals:

    • Must support installing everything or the web files only (no source files)
    • Must support installing the English resource files and give the option to selectivly install other languages
    • Support installing the default skin and optional skins
    • Support the ability to define an professional version and an interprise version that will have different steps that will be performed.
    • Integrated into our build environment (Draco.NET and NAnt)
    • Dialogs to prompt the user for additional information to setup the database
    • Ability to run SQL scripts from the installer
    • Ability to create a IIS website

    Ok now that's out of the way I'll describe how the files are laid out. We have 4 major pieces of the software and they are the Web, SqlDataProvider, Components and Controls assemblies. Of these, only the Web project is needed to run the website once the other 3 assemblies are built and placed in the Web's bin subdirectory. We also have some support tools and the localization files and each one could be an optional component that is installed. The final piece is we have a default skin and optional skins that could be installed on the web site. So I see 5 major sets of files to install.

    1. Web Files : files that are essential to run the web application, including the default skin
    2. Skin Files : optional set of files that allow the admin to change the layout of their site
    3. Source Files : files that can be optionally installed since the user may not want to build the project
    4. Support Tools
    5. Localization files

    Reading the WiX documentation it sounds like I can accomplish this using Features and defining which Files or Components are included with each Feature.

    Alright so now I have a basic idea of where i want to take the Forums installer so lets get started using it. I'll create a file Forums.wxs file and place it in a Installer directory off my project's root directory. In the case of the Forums it will be forums\Installer directory. I'll use the sample wxs file that is in the wix.chm file as the starting template.

    <?xml version='1.0'?>
    	<Product Id='EFDE9F61-68D2-4D4F-8C76-31CF1736CC94' Name='Community Server Forums' Language='1033' Version='1.0.0.0' Manufacturer='Telligent Systems'>
    		<Package Id='????????-????-????-????-????????????'
    			Description='A rich collaboration platform.'
    			Comments="Community Server is a rich knowledge management and collaboration platform designed to meet the demands of the most rigorous collaborative needs."
    			Manufacturer='Telligent Systems' InstallerVersion='200' Compressed='yes' />
    
    		<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
    		
    		<Directory Id='TARGETDIR' Name='SourceDir'>
    			<Directory Id="ProgramFilesFolder" Name="PFiles" >
    				<Directory Id="TelligentFolder" Name="TellSys" LongName="Telligent Systems" >
    					<Directory Id="CommunityServerFolder" Name="CommServ" LongName="Community Server" >
    						<Directory Id="DocFolder" Name="Docs" LongName="Documentation" >
    							<Component Id="docs" Guid="B1F09005-C841-4A9C-AC29-1FFA167D79C5" >
    								<File Id="eula" Name="eula.txt" DiskId="1" src="..\Documentation\eula.txt" /> 
    							</Component>
    						</Directory>
    					</Directory>
    				</Directory>
    			</Directory>
    		</Directory>
    
    		<Feature Id='Core Files' Title='Core Files' Level='1'>
    			<ComponentRef Id='docs' />
    		</Feature>
    	</Product>
    </Wix>
    

    After I wrote this post and then tried to run the installer I received a Windows Installer error 2755 which didn't tell me much. So I ran msiexec using the /log operation and looked at the log file and read I was getting an error 1639 ERROR_INVALID_COMMAND_LINE but it didn't tell me where. I opened up first.wxs and started to compare what I had that was different and noticed that my File ID had a period in it, so I removed it and tried again but this didn't fix the problem. Then I noticed that Feature ID had a space in it, so I removed the space and tried it again and this time it ran without a problem. So now my Feature element should look like this :

    <Feature Id='CoreFiles' Title='Core Files' Level='1'>
    	<ComponentRef Id='docs' />
    </Feature>
    

    To help you understand what is going is going on in this file the only thing of significance that is not already outlined in the first.wxs file is that I'm using a series of question marks '?' as the package id. This is a new extension to the WiX toolset that tells the tool to generate a new Package ID every time its built. This is to keep you from having installs that you will not be able to uninstall like you would if you were to use the same PackageID for two seperate builds of the MSI database.

    Over the next several weeks I'll document more and more of what I discover in using the WiX toolset.

    posted on Sunday, October 03, 2004 9:04 PM

  • 相关阅读:
    SQL常用语句(不定期更新)包含 日期格式,取列
    前端开发 ---浏览器自动刷新
    记录Redis使用中遇到的两个问题(原子性及数据完整性)
    Linux 输出重定向
    逆向手机内核,添加调试支持及绕过反调试
    阿里2014移动安全挑战赛第二题调试笔记
    在redhat6.4上编译z3求解器
    WCF学习笔记一(概述)
    DataReader反射泛型对象
    自定义配置节点(一)
  • 原文地址:https://www.cnblogs.com/huqingyu/p/53820.html
Copyright © 2011-2022 走看看