是否可以使用WIX在多个位置使用同一组件(快捷方式)?
免责声明:据我所知,VS安装项目无法满足(如上所述)的项目需求迫使我从我最喜欢的、经过验证的VS安装项目跳转到WIX。因此,我对WIX非常非常陌生,所以这可能是一个非常“无聊”的问题 慢慢来,我正在学习如何在桌面和程序文件菜单上创建主可执行文件的快捷方式。我已经找到了如何创建组件,并将其固定在ComponentGroup中,该组将包含主文件(可能是一个错误的移动),因此这就是我目前所拥有的:是否可以使用WIX在多个位置使用同一组件(快捷方式)?,wix,shortcut,Wix,Shortcut,免责声明:据我所知,VS安装项目无法满足(如上所述)的项目需求迫使我从我最喜欢的、经过验证的VS安装项目跳转到WIX。因此,我对WIX非常非常陌生,所以这可能是一个非常“无聊”的问题 慢慢来,我正在学习如何在桌面和程序文件菜单上创建主可执行文件的快捷方式。我已经找到了如何创建组件,并将其固定在ComponentGroup中,该组将包含主文件(可能是一个错误的移动),因此这就是我目前所拥有的: <Fragment> <ComponentGroup Id="ProductC
<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="CMP_FooSetup">
<File Id="FILE_Foo.exe" Source="$(var.Foo.TargetPath)" KeyPath="yes"/>
</Component>
<Component Id="ApplicationShortcut">
<Shortcut
Id="FooShortcut"
Name="Foo"
Description="Foos your Bar."
Target="[#FILE_Foo.exe]"
WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
<RegistryValue
Root="HKCU"
Key="Software\FooCompany\Foo"
Name="installed" Type="integer" Value="1"
KeyPath="yes"/>
<RemoveFile Id="RemoveFooShortcut" Name="Foo.lnk" On="uninstall"/>
</Component>
</ComponentGroup>
我要一个快捷方式转到桌面,另一个快捷方式转到程序菜单。为此,我定义了以下文件夹结构:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="FooBar">
<!--This is where a shortcut should be placed. How? -->
</Directory>
</Directory>
<Directory Id="DesktopFolder">
<!--This is where a shortcut should be placed. How? -->
</Directory>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLPARENT" Name="FooBar">
<Directory Id="INSTALLFOLDER" Name="Foo"/>
</Directory>
</Directory>
</Directory>
我骨子里的一切和作为一名程序员的经验(尽管可能有限)都在尖叫“嘿,我应该能够使用目录结构中快捷方式组件的ID来指示安装程序创建这些快捷方式!”,但我不知道如何做到这一点。它看起来应该是相当初级的,但我的搜索结果却一无所获
这可能吗?若有,;怎样?若否,;我该怎么做才能让它工作
请友好…不可能在多个位置(目录)使用组件。另一种方法是创建多个组件,将
目录
属性从组件组
移动到组件
标记
<ComponentGroup Id="ProductComponents">
<Component Id="CMP_FooSetup" Directory="INSTALLFOLDER">
<File Id="FILE_Foo.exe" Source="$(var.Foo.TargetPath)" KeyPath="yes"/>
</Component>
<Component Id="ApplicationShortcut" Directory="INSTALLFOLDER">
<Shortcut
Id="FooShortcut"
Name="Foo"
Description="Foos your Bar."
Target="[#FILE_Foo.exe]"
WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
<RegistryValue
Root="HKCU"
Key="Software\FooCompany\Foo"
Name="installed" Type="integer" Value="1"
KeyPath="yes"/>
<RemoveFile Id="RemoveFooShortcut" Name="Foo.lnk" On="uninstall"/>
</Component>
<!-- Here I added the Directory attrib and changed the Id. -->
<Component Id="DesktopShortcut" Directory="DesktopFolder">
<Shortcut
<!-- New Id -->
Id="FooShortcutDesktop"
Name="Foo"
Description="Foos your Bar."
Target="[#FILE_Foo.exe]"
WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
<RegistryValue
Root="HKCU"
Key="Software\FooCompany\Foo"
<!-- New Name -->
Name="installed_desktop" Type="integer" Value="1"
KeyPath="yes"/>
<!-- New Id -->
<RemoveFile Id="RemoveFooShortcutDesktop" Name="Foo.lnk" On="uninstall"/>
</Component>
</ComponentGroup>
那么我希望我的编辑能更直接地回答你的问题。:)谢谢回答透视图的标题问题时,组件是一个或多个功能的成员。
...
<Directory Id="DesktopFolder">
<Component>
<Shortcut ... />
</Component>
</Directory>
...