2013-01-25 290 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時顯示該消息。

現在您的升級應該可以正常工作。