2013-01-25 274 views
1

我从VS2010升级到VS2012。 我有一个安装程序的客户端应用程序。我使用Windows安装程序来创建安装程序。 现在我想升级我的项目,并且遇到VS2012不再支持Windows安装程序的问题。 我试图用WIX创建一个新的设置。 这里我新的设置文件:WIX-Setup卸载旧版本

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
<Product Id="FADB7F3E-0E92-494E-B627-930BC217DE29" Name="SMC" Language="1033" Version="1.1.1" 
     Manufacturer="abc" UpgradeCode="1BC520F0-F6CB-4E70-8F7B-9F398BE4F25B"> 
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> 
<!--<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />--> 
<MediaTemplate /> 


<Upgrade Id="1BC520F0-F6CB-4E70-8F7B-9F398BE4F25B"> 
    <!--<UpgradeVersion Minimum="1.1.1.0" IncludeMinimum="no" OnlyDetect="no" Property="NEWERVERSIONDETECTED" />--> 
    <UpgradeVersion Minimum="0.0.0.0" Maximum="1.1.1.0" IncludeMinimum="yes" IncludeMaximum="yes" Property="OLDERVERSIONBEINGUPGRADED" /> 
</Upgrade> 

<InstallExecuteSequence> 
    <RemoveExistingProducts After="InstallFinalize" /> 
    <Custom Action="NewerVersion" After="FindRelatedProducts">NEWERVERSIONDETECTED</Custom> 
</InstallExecuteSequence> 

<CustomAction Id="NewerVersion" Error="A later version of [ProductName] is already installed." /> 


<!--<Fragment>--> 
<Directory Id="TARGETDIR" Name="SourceDir"> 
    <Directory Id="ProgramFilesFolder"> 
    <Directory Id="INSTALLFOLDER" Name="abc"> 
     <Directory Id="PROGFOLDER" Name="SMC"> 
     <Directory Id="IMAGES" Name="images"/> 
     <Directory Id="CULTURE" Name="de-DE" /> 
     </Directory> 
    </Directory> 
    <Directory Id="ProgramMenuFolder"> 
     <Directory Id="SMC_Shortcut" Name="abc"> 
     </Directory> 
    </Directory> 
    </Directory> 
</Directory> 
<!--</Fragment>--> 

<!--<Fragment>--> 
<DirectoryRef Id="IMAGES"> 
    <Component Id="Image" Guid="82BB42E8-AD7A-4E62-B5B7-37C7EA2DFC8D"> 
    <File Id="Program_Icon" Source="C:\Projects\SMC\Dev\SMC\images\SMC.ico" KeyPath="yes" Checksum="yes" /> 
    </Component> 
</DirectoryRef> 
<DirectoryRef Id="CULTURE"> 
    <Component Id="Lang" Guid="109183AC-3F37-4BDC-B659-38C12CE4BAD3"> 
    <File Id="Language" Source="C:\Projects\SMC\Dev\Culture\bin\Release\de-DE\Culture.resources.dll" KeyPath="yes" Checksum="yes" /> 
    </Component> 
</DirectoryRef> 
<DirectoryRef Id="PROGFOLDER"> 
    <Component Id="Dll_Culture" Guid="AC8103CF-FDFB-4792-BF84-577F27A3CC1B"> 
    <File Id="culture_dll" Source="C:\Projects\SMC\Dev\Culture\bin\Release\Culture.dll" KeyPath="yes" Checksum="yes" /> 
    </Component> 
    <Component Id="Dll_Helper" Guid="33DEC912-AF34-4473-8E6D-E36D07B644B1"> 
    <File Id="helper_dll" Source="C:\Projects\SMC\Dev\Helper\bin\Release\Helper.dll" KeyPath="yes" Checksum="yes" /> 
    </Component> 
    <Component Id="Dll_Secman" Guid="9E543EF7-5205-49F2-9B2A-52D0D469781D"> 
    <File Id="secman_dll" Source="C:\Projects\SMC\Tools\secman.dll" KeyPath="yes" Checksum="yes" /> 
    </Component> 
    <Component Id="Dll_SecurityManager" Guid="AF80A4B2-3B5F-4CA9-B357-65AC9031CFF3"> 
    <File Id="securityManager_2005_dll" Source="C:\Projects\SMC\Tools\SecurityManager.2005.dll" KeyPath="yes" Checksum="yes" /> 
    </Component> 
    <Component Id="Dll_UDDI" Guid="35EFC304-EB62-4EB4-A1F4-4D0E0AE56A76"> 
    <File Id="uddiConnect_dll" Source="C:\Projects\SMC\Tools\abc.UddiConnectLib.dll" KeyPath="yes" Checksum="yes" /> 
    </Component> 
    <Component Id="Exe_SMC" Guid="48FF7F56-D4E1-4CE6-B333-8F8BF73B6D58"> 
    <File Id="exe_file" Source="C:\Projects\SMC\Dev\SMC\bin\Release\SMC.exe" KeyPath="yes" Checksum="yes" /> 
    </Component> 
    <Component Id="Exe_SMC.config" Guid="865139C6-740A-499B-8C0E-FAF163A4A98F"> 
    <File Id="exe_file.config" Source="C:\Projects\SMC\Dev\SMC\bin\Release\SMC.exe.config" KeyPath="yes" Checksum="yes" /> 
    </Component> 
</DirectoryRef> 
<DirectoryRef Id="SMC_Shortcut"> 
    <Component Id="shortcut" Guid="46E8006D-9A0A-4086-94AE-A002F6C5B4D7"> 
    <Shortcut Id="SMC_abc" Name="SMC" Description="SMC" 
       Target="[PROGFOLDER]SMC.exe" Icon="SMC_Icon" Arguments="prod"> 
     <Icon Id="SMC_Icon" SourceFile="C:\Projects\SMC\Dev\SMC\images\SMC.ico" /> 
    </Shortcut> 
    <RegistryValue Root="HKMU" Key="Software\Microsoft\Windows\CurrentVersion\Run" Name="SMC" 
        Type="string" Value="[PROGFOLDER]SMC.exe prod" KeyPath="yes" /> 
    <RemoveFile Id="SMC_abc" Name="SMC" On="uninstall" /> 
    </Component> 
</DirectoryRef> 
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 
    <ComponentRef Id="Image" /> 
    <ComponentRef Id="Lang" /> 
    <ComponentRef Id="Dll_Culture" /> 
    <ComponentRef Id="Dll_Helper" /> 
    <ComponentRef Id="Dll_Secman" /> 
    <ComponentRef Id="Dll_SecurityManager" /> 
    <ComponentRef Id="Dll_UDDI" /> 
    <ComponentRef Id="Exe_SMC" /> 
    <ComponentRef Id="Exe_SMC.config" /> 
    <ComponentRef Id="shortcut" /> 
</ComponentGroup> 

<!--</Fragment>--> 

<Feature Id="ProductFeature" Title="SMC.SetupTest" Level="1"> 
    <ComponentGroupRef Id="ProductComponents" /> 
</Feature> 
<Property Id="ARPPRODUCTICON">RemoveIcon</Property> 
<Icon Id="RemoveIcon" SourceFile="C:\Projects\SMC\Dev\SMC\images\SMC.ico" /> 


<CustomAction Id="OurAction" FileKey="exe_file" ExeCommand="prod" Execute="immediate" Return="asyncNoWait" /> 

它安装了新版本,但不会卸载旧的。 旧的程序仍然出现在控制面板的程序和功能中。 如何删除此版本。

我试着用两个版本的Wix-Setup进行安装。 当我尝试安装较新的版本时,它显示一个消息框,其中包含以下消息: 安装此软件的另一个版本...

有人可以帮我吗?

+0

您的新安装程序的升级表中列出了您的原始安装程序的GUID? – Lex

+0

UpgradeCode和Upgrade-ID应该是一样的,对吗? 此GUID应该是之前包的GUID。 – user2010590

+0

@ user2010590 - GUID应该是包之前的升级ID,而不是包ID。 –

回答

1

你可以做到这一点的几个步骤:

  1. 使用Orca打开旧MSI你。
  2. 转至财产表并找到UpgradeCode财产
  3. 复制UpgradeCode财产的GUID值。
  4. 在您的.wxs文件中使用该GUID作为Product/@UpgradeCode属性。相同的GUID将新的MSI与旧的MSI相关联。
  5. 将.wxs文件中的Upgrade元素替换为MajorUpgrade元素。
  6. DowngradeErrorMessage添加到MajorUpgrade元素中,并显示一条消息,当已安装新版本时尝试安装旧的MSI时显示该消息。

现在您的升级应该可以正常工作。