我有一個帶有WiX安裝程序的C#項目。Wix卸載不會刪除文件
當我安裝我的應用程序時,所有工作。我有:
- 我的compagny文件夾在程序文件(x86),包含我的應用程序文件夾和驅動程序文件夾。
- 快捷桌面
- 快捷在開始菜單
當安裝應用程序,我可以運行我的MSI和我有一個選項來卸載。但是當我卸載我的應用程序時,只有驅動程序文件夾被刪除(MyApplication_Drivers
)。我仍然有我的應用程序文件夾和快捷方式。
我失蹤了什麼?
還有就是我的product.wxs代碼(全部代碼,因爲我不知道從哪兒來的問題):
<?xml version="1.0" encoding="UTF-8"?>
<?define compagny = "My compagny"?>
<?define product = "MyApplication"?>
<?define version = "!(bind.FileVersion.MyApplication.exe)"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="$(var.product)"
Language="1033"
Version="$(var.version)"
Manufacturer="$(var.compagny)"
UpgradeCode="***">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Media Id="1" Cabinet="MyApplication.cab" EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="$(var.product)" Level="1">
<ComponentGroupRef Id="ProductComponents"/>
<ComponentRef Id ="InstallFonts" />
<ComponentRef Id ="ApplicationShortcut"/>
<ComponentRef Id ="ApplicationShortcutDesk"/>
</Feature>
<Property Id="WIXUI_INSTALLDIR" Value="COMPAGNYFOLDER"/>
<WixVariable Id="WixUIBannerBmp"
Value=".\Images\WixUIBannerBmp.bmp"/>
<WixVariable Id="WixUIDialogBmp"
Value=".\Images\WixUIDialogBmp.bmp"/>
<UI>
<UIRef Id="WixUI_Custom"/>
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
</UI>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="FontsFolder" />
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.compagny)"/>
</Directory>
<Directory Id="DesktopFolder" SourceName="Desktop"/>
<Directory Id="ProgramFilesFolder">
<Directory Id="COMPAGNYFOLDER" Name="$(var.compagny)">
<Directory Id="INSTALLFOLDER" Name="$(var.product)">
<Directory Id="fr" Name="fr"/>
<Directory Id="SETTINGS" Name="Settings">
<Directory Id="PRINTERS" Name="Printers"/>
</Directory>
</Directory>
<Directory Id="Drivers" Name="MyApplication_Drivers"/>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="***">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="$(var.product)"
Description="$(var.product) application"
Target="[#MyApplication.exe]"
WorkingDirectory="INSTALLFOLDER"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="SOFTWARE\$(var.compagny)\$(var.product)" Name="installedStart" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutDesk" Guid="***">
<Shortcut Id="ApplicationStartDeskShortcut"
Name="$(var.product)"
Description="$(var.product) application"
Target="[#MyApplication.exe]"
WorkingDirectory="INSTALLFOLDER"/>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="SOFTWARE\$(var.compagny)\$(var.product)" Name="installedDesk" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="FontsFolder">
<Component Id="InstallFonts" Guid="{***}" Permanent="yes">
<File Id="OCRB_Medium.ttf" Source="$(var.SolutionDir)_Required\OCRB_Medium.ttf" TrueType="yes" />
<File Id="OCRBS___.TTF" Source="$(var.SolutionDir)_Required\OCRBS___.TTF" TrueType="yes" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents">
<!-- Application -->
<Component Id="ProductComponent" Guid="{***}" Directory="INSTALLFOLDER" UninstallWhenSuperseded="yes">
<!-- DLL -->
<File Id="Bitmap.Core.dll" Source="$(var._Delivery.TargetDir)..\bin\Bitmap.Core.dll"/>
<File Id="PdfLib.dll" Source="$(var._Delivery.TargetDir)..\bin\PdfLib.dll"/>
<!-- EXE -->
<File Id="MyApplication.exe" Source="$(var._Delivery.TargetDir)..\bin\MyApplication.exe"/>
<File Id="MyApplication.exe.config" Source="$(var._Delivery.TargetDir)..\bin\MyApplication.exe.config"/>
</Component>
<!-- fr -->
<Component Id="FRComponent" Guid="{***}" Directory="fr" UninstallWhenSuperseded="yes">
<File Id="resources-fr.dll" Source="$(var._Delivery.TargetDir)..\bin\fr\resources-fr.dll" />
</Component>
<!-- Settings -->
<Component Id="SetComponent" Guid="{***}" Directory="SETTINGS" UninstallWhenSuperseded="yes">
<File Id="Settings.xml" Source="$(var.MyApplication.ProjectDir)Settings\Settings.xml" />
</Component>
<!-- Printers -->
<Component Id="PrintComponent" Guid="{***}" Directory="PRINTERS" UninstallWhenSuperseded="yes">
<File Id="Sticker.xml" Source="$(var.MyApplication.ProjectDir)Settings\Printers\Sticker.xml" />
</Component>
<!-- Resources -->
<Component Id="Drivers" Guid="{***}" Directory="Drivers" UninstallWhenSuperseded="yes">
<File Id="drivers.exe" Source="$(var.SolutionDir)_Required\drivers.exe"/>
<File Id="user_manual_E.pdf" Source="$(var.SolutionDir)_Required\user_manual_E.pdf"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
編輯:
舊版本的代碼是完美的工作
我打印日誌時卸載和此行似乎與此問題有關:
MSI(C)(E8:BC)[10:58:16:769]:如果不允許 成分的卸載:自另一端{我的GUID之一}存在
我已經看到了一些這些話題之前,但發出簡化版,爲我工作。經過一番調查,似乎我的問題很簡單(我會添加答案) –