所以我已经解决了这个问题好几天了。我的安装程序根本不会在Windows中漫游AppData文件夹中添加任何内容或从中删除任何内容。我是Wix的新手,这是我的第一个安装人员。该程序还随附一个Bootstrapper,它安装了各种prequisitaries和.NET Framework。我使用的代码如下。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="USBackup" Language="1033" Version="!(bind.fileVersion.USBackup.exe)" Manufacturer="Ed Rose" UpgradeCode="795ea019-054a-4f34-8c9a-cb4e607897c0">
<Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Icon Id="icon.ico" SourceFile="..\USBackup\resources\usb.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<UIRef Id="WixUI_Minimal" />
<UIRef Id="WixUI_ErrorProgressText" />
<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message='This setup requires the .NET Framework 4.5 installed.'>
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>
<Feature Id="ProductFeature" Title="Setup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id='ProgramMenuDir' />
<ComponentRef Id='AppDataDir'/>
<ComponentRef Id='DevicesDir'/>
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="USBackup" />
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="USBackup">
<Component Id="ProgramMenuDir" Guid="{B01A59A5-ADA0-43FD-B14F-D479CD002E72}">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Directory Id="CommonAppDataFolder" Name="CommonAppData">
<Directory Id="AppDataDir" Name="USBackup">
<Component Id="AppDataDir" Guid="{573BF504-1F52-40FE-A78A-96F43924379E}">
<RemoveFolder Id="AppDataDir" On="uninstall"/>
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
<Directory Id="DevicesDir" Name="Devices">
<Component Id="DevicesDir" Guid="{E145EA47-109F-42E7-ABAB-4E9A87FEC464}">
<RemoveFolder Id="DevicesDir" On="uninstall"/>
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Guid="{9D9BA12C-0859-46F0-B5E1-2A59BE96F83D}">
<File Source="$(var.USBackup.TargetPath)" KeyPath="yes">
<Shortcut Id="start" Directory="ProgramMenuDir" Name="USBackup" WorkingDirectory='INSTALLDIR' Icon="icon.ico" IconIndex="0" Advertise="yes" />
</File>
</Component>
<Component Guid="{6B473C52-6901-4FAC-A48B-20FC13A49C21}">
<File Source="..\USBackup\bin\Release\AutoUpdater.NET.dll" KeyPath="yes"/>
</Component>
<Component Guid="{6191F8CC-98A8-4424-A846-44DC1EB2A22C}">
<File Source="..\USBackup\bin\Release\USBackup.exe.config" KeyPath="yes"/>
</Component>
<Component Guid="{4E183A88-69DE-49D1-9142-13A2346443AF}">
<File Source="..\USBackup\bin\Release\USBackup.exe.manifest" KeyPath="yes"/>
</Component>
<!--Set to open on startup-->
<Component Id="RegistryKey" Guid="{8DBAB7DD-D9CD-4EC4-97F9-9A6131B40108}" Shared="yes">
<RegistryKey Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\Run">
<RegistryValue Id="startupValue" Action="write" Name="USBackup" Value="[INSTALLFOLDER]USBackup.exe" Type="string"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
它构建时没有错误或警告。为什么不接触AppData目录?
答案 0 :(得分:0)
你没有给出任何理由来创建它。
包含<CreateFolder/>
,因此
<Component Id="AppDataDir" Guid="{573BF504-1F52-40FE-A78A-96F43924379E}">
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
<CreateFolder />
</Component>