C# 如何使用wix安装程序在自定义文件夹(程序文件文件夹除外)中安装应用程序
我已经用wix创建了一个安装程序。默认情况下,应用程序安装在Program Files文件夹下。我需要在C# 如何使用wix安装程序在自定义文件夹(程序文件文件夹除外)中安装应用程序,c#,visual-studio-2010,visual-studio,c#-4.0,wix,C#,Visual Studio 2010,Visual Studio,C# 4.0,Wix,我已经用wix创建了一个安装程序。默认情况下,应用程序安装在Program Files文件夹下。我需要在c:目录下为我的应用程序创建一个文件夹,并在其中安装我的应用程序 <Fragment> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="WINDOWSVOLUME" > <Directory Id="INSTALLLOCATION" Name="WIXDemo
c:
目录下为我的应用程序创建一个文件夹,并在其中安装我的应用程序
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WINDOWSVOLUME" >
<Directory Id="INSTALLLOCATION" Name="WIXDemoApp">
</Directory>
</Directory>
</Directory>
<SetDirectory Id="WINDOWSVOLUME" Value="c"/>
这给了我另一个错误“错误LGHT0204:ICE99:目录名:WindowsVolume与MSI公共属性之一相同,可能会造成不可预见的副作用。
”。谷歌搜索和引用并修复了此错误。但不适用于我,我仍然收到与MSI相同的错误“错误LGHT0204:ICE99:目录名:WindowsVolume与MSI公共属性之一相同,可能会导致不可预见的副作用。”。知道会出现什么问题吗。我在上找到了此提示。提示说使用WindowsVolume id
TARGETDIR和系统分区
尝试安装到系统驱动器根目录的子目录时
(例如“C:\application”),可以假定
像
TARGETDIR是指系统分区,与ProgramFilesFolder一样
始终作为TARGETDIR的子级提供。事实并非如此;TARGETDIR
是可用磁盘空间最多的分区。它甚至可以是
外部硬盘上的分区。将其设置为真实系统
分区时,请使用以下方法:
SetDirectory元素
是必需的,因为尝试直接使用WindowsVolume会导致
错误LGHT0204:ICE99:目录名:WindowsVolume与MSI公共属性之一相同,可能会导致不可预见的副作用。
签署MSI
Windows Installer区分大小写,因此
WINDOWSVOLUME
无法工作。您可以执行以下操作:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="SetupProject1" />
</Directory>
</Directory>
<SetDirectory Id="INSTALLLOCATION" Value="[WindowsVolume]SetupProject1" />
</Fragment>
对于第二个错误,您混合了两个不同的ID:
INSTALLFOLDER
和INSTALLLOCATION
。选择一个并在两个位置使用它。您是否计划无人参与安装?我已更新了问题。我收到此错误“错误LGHT0204:ICE99:目录名:WindowsVolume与MSI公共属性之一相同,可能会导致不可预见的副作用。“。请查看我的“更新”问题。此方法对我来说效果非常好,并且没有显示错误LGHT0204:ICE99。很高兴回答有帮助。
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WindowsVolume" >
<Directory Id="INSTALLLOCATION" Name="WIXDemoApp">
</Directory>
</Directory>
</Directory>
<SetDirectory Id="WindowsVolume" Value="c"/>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLLOCATION">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="MyApplication.exe">
<File Source="$(var.MyApplication.TargetPath)" Name="MyApp.exe" Id="MYAPPEXE" KeyPath="yes" />
<!-- TODO: Insert files, registry keys, and other resources here. -->
</Component>
</ComponentGroup>
</Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLLOCATION" Name="SetupProject1">
</Directory>
</Directory>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WINDOWSVOLUME" >
<Directory Id="INSTALLLOCATION" Name="SetupProject1">
</Directory>
</Directory>
</Directory>
<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]"/>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="SetupProject1" />
</Directory>
</Directory>
<SetDirectory Id="INSTALLLOCATION" Value="[WindowsVolume]SetupProject1" />
</Fragment>