Roy*_*yal 5 c# wix visual-studio-2010 visual-studio c#-4.0
我使用wix创建了一个安装程序.默认情况下,应用程序安装在Program Files文件夹下.我需要在c:目录下为我的应用程序创建一个文件夹,并在那里安装我的应用程序.
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WINDOWSVOLUME" >
<Directory Id="INSTALLLOCATION" Name="WIXDemoApp">
</Directory>
</Directory>
</Directory>
<SetDirectory Id="WINDOWSVOLUME" Value="c"/>
Run Code Online (Sandbox Code Playgroud)
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- 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>
Run Code Online (Sandbox Code Playgroud)
我收到以下错误" error LGHT0094: Unresolved reference to symbol 'Directory:INSTALLFOLDER' in section 'Fragment:'".
更新:
<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>
Run Code Online (Sandbox Code Playgroud)
这给了我另一个错误"error LGHT0204: ICE99: The directory name: WindowsVolume is the same as one of the MSI Public Properties and can cause unforeseen side effects.".Google和refereed this and this to fix this.But not working for my,但我得到的错误与"错误LGHT0204:ICE99:目录名称:WindowsVolume与其中一个相同MSI公共属性可能会导致无法预料的副作用.".任何想法会出现什么问题.
我在kentie.net-Wix Tips & Tricks上找到了这个提示。提示说使用WINDOWSVOLUME id。
TARGETDIR 和系统分区
当尝试安装到系统驱动器根目录的子目录(例如“C:\application”)时,假设在类似
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLLOCATION" Name="SetupProject1">
</Directory>
</Directory>
Run Code Online (Sandbox Code Playgroud)
TARGETDIR指的是系统分区,因为ProgramFilesFolder总是作为 TARGETDIR 的子项给出。不是这种情况; TARGETDIR 是可用磁盘空间最多的分区。它甚至可以是外部硬盘驱动器上的分区。要将其设置为真正的系统分区,请使用以下方法:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WINDOWSVOLUME" >
<Directory Id="INSTALLLOCATION" Name="SetupProject1">
</Directory>
</Directory>
</Directory>
<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]"/>
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
对于您的第二个错误,您将混合两个不同的ID:INSTALLFOLDER和INSTALLLOCATION.选择一个并在两个地方使用它.
| 归档时间: |
|
| 查看次数: |
2887 次 |
| 最近记录: |