我一直试图在我的Wix安装套件中添加一个捷径,最令人沮丧的是没有取得多大成功。我试图解决这种情况,从网上的一个例子中抄下一些代码,但似乎没有用。以下是我的product.wxs文件中的完整列表
<?xml version="1.0" encoding="UTF-8"?>
<?define SourceDir = "..\..\Bin\Debug" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="PSALERTS Query 2015" Language="1033" Version="1.0.0.0" Manufacturer="Iberdrola, S.A." UpgradeCode="a6fd9179-efe6-47d1-bd8f-aec182d36c8b">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Property Id="ARPSYSTEMCOMPONENT">0</Property>
<Feature Id="ProductFeature" Title="PSALERTS Query 2015" Level="1">
<ComponentRef Id="cmpDirQuery" />
<ComponentRef Id="cmpDirQueryOutput" />
<ComponentRef Id="cmpQueryExe" />
<ComponentRef Id="cmpQueryPdb" />
<ComponentRef Id="cmpBusinessLogicDll" />
<ComponentRef Id="cmpBusinessLogicPdb" />
<ComponentRef Id="cmpBusinessObjectDll" />
<ComponentRef Id="cmpBusinessObjectPdb" />
<ComponentRef Id="cmpCommonDll" />
<ComponentRef Id="cmpCommonPdb" />
<ComponentRef Id="cmpDataAccessDll" />
<ComponentRef Id="cmpDataAccessPdb" />
<ComponentRef Id="cmpDPAPIHelperDll" />
<ComponentRef Id="cmpDPAPIHelperPdb" />
<ComponentRef Id="cmpLoggerDll" />
<ComponentRef Id="cmpLoggerPdb" />
<ComponentRef Id="cmpPSALERTSIni" />
<ComponentRef Id="cmpPSALERTSXltm" />
<ComponentRef Id="cmpPSALERTS2015UserGuideChm" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="dirSPEnergyNetworks" Name="SP Energy Networks">
<!-- <Component Id="cmpDirSPEnergyNetworks" Guid="{4CC20BF9-6F88-4754-8570-560B27EB2CED}" Transitive="yes" /> -->
<Directory Id="dirPSALERTS" Name="PSALERTS">
<!-- <Component Id="cmpDirPSALERTS" Guid="{4337B6A5-9080-4BE1-9C72-243B5F9E7E36}" Transitive="yes" /> -->
<Directory Id="dirQuery" Name="Query">
<Component Id="cmpDirQuery" Guid="{7DC2EADF-08B4-4FC8-9643-A83F327733AB}" KeyPath="yes">
<CreateFolder Directory="dirQuery" />
<RemoveFile Id="PurgeQuery" Name="*.*" On="uninstall" />
<RemoveFolder Id="idDirQuery" On="uninstall" Directory="dirQuery" />
</Component>
<Directory Id="dirQueryOutput" Name="QueryOutput">
<Component Id="cmpDirQueryOutput" Guid="{E7841870-CCBE-4186-B586-3DD95017F380}">
<CreateFolder Directory="dirQueryOutput" />
<RemoveFile Id="PurgeQueryOutput" Name="*.*" On="uninstall" />
<RemoveFolder Id="idDirQueryOutputRemove" On="uninstall" Directory="dirQueryOutput" />
</Component>
</Directory>
<Component Id="cmpQueryExe" Guid="*">
<File Id="filQueryExe"
KeyPath="yes"
Vital ="yes"
Source="$(var.SourceDir)\Query.exe">
</File>
<Shortcut Id="startMenuQuery"
Directory="ProgramFilesFolder"
Advertise="no"
Name="Query"
LongName="PSALERTS Query 2015"
WorkingDirectory="INSTALLDIR"
/>
<RemoveFile Id="RemoveDesktopShortcut" Name="PSALERTS Query 2015" On="uninstall"/>
<RemoveRegistryKey Id="RemoveQueryRegKey" Root="HKLM" Key="SOFTWARE\SP Energy Networks\PSALERTS\Query" Action="removeOnUninstall" />
</Component>
<Component Id="cmpQueryPdb" Guid="*">
<File Id="filQueryPdb" KeyPath="yes" Source="$(var.SourceDir)\Query.pdb" />
</Component>
<Component Id="cmpBusinessLogicDll" Guid="*">
<File Id="filBusinessLogicDll" KeyPath="yes" Source="$(var.SourceDir)\BusinessLogic.dll"/>
</Component>
<Component Id="cmpBusinessLogicPdb" Guid="*">
<File Id="filBusinessLogicPdb" KeyPath="yes" Source="$(var.SourceDir)\BusinessLogic.pdb" />
</Component>
<Component Id="cmpBusinessObjectDll" Guid="*">
<File Id="filBusinessObjectDll" KeyPath="yes" Source="$(var.SourceDir)\BusinessObject.dll" />
</Component>
<Component Id="cmpBusinessObjectPdb" Guid="*">
<File Id="filBusinessObjectPdb" KeyPath="yes" Source="$(var.SourceDir)\BusinessObject.pdb" />
</Component>
<Component Id="cmpCommonDll" Guid="*">
<File Id="filCommonDll" KeyPath="yes" Source="$(var.SourceDir)\Common.dll" />
</Component>
<Component Id="cmpCommonPdb" Guid="*">
<File Id="filCommonPdb" KeyPath="yes" Source="$(var.SourceDir)\Common.pdb" />
</Component>
<Component Id="cmpDataAccessDll" Guid="*">
<File Id="filDataAccessDll" KeyPath="yes" Source="$(var.SourceDir)\DataAccess.dll" />
</Component>
<Component Id="cmpDataAccessPdb" Guid="*">
<File Id="filDataAccessPdb" KeyPath="yes" Source="$(var.SourceDir)\DataAccess.pdb" />
</Component>
<Component Id="cmpDPAPIHelperDll" Guid="*">
<File Id="filDPAPIHelperDll" KeyPath="yes" Source="$(var.SourceDir)\DPAPIHelper.dll" />
</Component>
<Component Id="cmpDPAPIHelperPdb" Guid="*">
<File Id="filDPAPIHelperPdb" KeyPath="yes" Source="$(var.SourceDir)\DPAPIHelper.pdb" />
</Component>
<Component Id="cmpLoggerDll" Guid="*">
<File Id="filLoggerDll" KeyPath="yes" Source="$(var.SourceDir)\Logger.dll" />
</Component>
<Component Id="cmpLoggerPdb" Guid="*">
<File Id="filLoggerPdb" KeyPath="yes" Source="$(var.SourceDir)\Logger.pdb" />
</Component>
<Component Id="cmpPSALERTSIni" Guid="*">
<File Id="filPSALERTSIni" KeyPath="yes" Source="$(var.SourceDir)\PSALERTS.ini" />
</Component>
<Component Id="cmpPSALERTSXltm" Guid="*">
<File Id="filPSALERTSXltm" KeyPath="yes" Source="$(var.SourceDir)\PSALERTS.xltm" />
</Component>
<Component Id="cmpPSALERTS2015UserGuideChm" Guid="*">
<File Id="filPSALERTS2015UserGuideChm" KeyPath="yes" Source="$(var.SourceDir)\UserGuide\PSALERTS2015UserGuide.Chm" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
有人可以帮忙吗。
亲切的问候 保罗J。
答案 0 :(得分:0)
这是桌面快捷方式和卸载快捷方式的示例。
<DirectoryRef Id="DesktopFolder">
<!--Shortcut -->
<Component Id="cmp1" Guid="{D61A6AD5-8C48-4894-8816-DBCE98A2D42D}">
<Shortcut Id="Shortcut.ID"
Name="some name"
Target="[INSTALLDIR]some.exe"
WorkingDirectory="INSTALLDIR"
Icon="some.exe"/>
<RemoveFile Id="RemoveDesktopShortcut" Name="some name" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\!(loc.ManufacturerName)\Productname" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
<!--Uninstall Shortcut-->
<Component Id="cmp.Uninstall.shortcut" Guid="{98FCEE68-0BE0-4C99-B961-75066797C140}">
<Shortcut Id="UninstallProduct"
Name="Uninstall"
Description="Uninstalls My Application"
Directory="INSTALLDIR"
Target="[SystemFolder]msiexec.exe"
Arguments="/x [ProductCode] /qb"/>
<RemoveFile Id="RemoveUninstallShortcut" Name="Uninstall" Directory="INSTALLDIR" On="uninstall"/>
<RegistryValue Root="HKMU" Key="Software\!(loc.ManufacturerName)\UninstallShortcut" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<Icon Id="some.exe" SourceFile="$(var.ResourcesDir)Some.ico"/>
<ComponentGroup Id ="ShortCuts">
<ComponentRef Id="cmp1"/>
<ComponentRef Id="cmp.Uninstall.shortcut"/>
</ComponentGroup>
答案 1 :(得分:0)
我已经在你的主要exe的Component中移动了几个东西。这应该是它创建的,你可能需要移动它以使其准确到达你想要的位置。
<Component Id="cmpQueryExe" Guid="*">
<File Id="filQueryExe"
KeyPath="yes"
Vital ="yes"
Source="$(var.SourceDir)\Query.exe">
<Shortcut Id="startMenuQuery"
Directory="ProgramMenuDir"
Advertise="no"
Name="Query"
LongName="PSALERTS Query 2015"
WorkingDirectory="INSTALLDIR" Icon="$(var.SourceDir)\Query.exe" />
</File>
<RemoveFolder Id="RemoveDesktopShortcut" Directory="ProgramMenuDir" Name="PSALERTS Query 2015" On="uninstall"/>
<RemoveRegistryKey Id="RemoveQueryRegKey" Root="HKLM" Key="SOFTWARE\SP Energy Networks\PSALERTS\Query" Action="removeOnUninstall" />
</Component>
并进一步向下:
<Component Id="cmpPSALERTS2015UserGuideChm" Guid="*">
<File Id="filPSALERTS2015UserGuideChm" KeyPath="yes" Source="$(var.SourceDir)\UserGuide\PSALERTS2015UserGuide.Chm" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id='SPEnergyNetworksDir' Name='SP Energy Networks'>
<Directory Id="ProgramMenuDir" Name="PSALERTS Query 2015" />
</Directory>
</Directory>
</Directory>
</Fragment>
摘要:
答案 2 :(得分:0)
安德鲁
感谢您的努力,我今天下午设法让它发挥作用。我的问题是试图与我的具体案例分开处理示例代码摘录,最后我设法使用以下内容工作,巧合在最终答复之前: - )
...
<Icon Id="Query.exe" SourceFile="$(var.SourceDir)\Query.exe" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="dirSPEnergyNetworks" Name="SP Energy Networks">
<!-- <Component Id="cmpDirSPEnergyNetworks" Guid="{4CC20BF9-6F88-4754-8570-560B27EB2CED}" Transitive="yes" /> -->
<Directory Id="dirPSALERTS" Name="PSALERTS">
<!-- <Component Id="cmpDirPSALERTS" Guid="{4337B6A5-9080-4BE1-9C72-243B5F9E7E36}" Transitive="yes" /> -->
<Directory Id="dirQuery" Name="Query">
<Component Id="cmpDirQuery" Guid="{7DC2EADF-08B4-4FC8-9643-A83F327733AB}" KeyPath="yes">
<CreateFolder Directory="dirQuery" />
<RemoveFile Id="PurgeQuery" Name="*.*" On="uninstall" />
<RemoveFolder Id="idDirQuery" On="uninstall" Directory="dirQuery" />
<RemoveFolder Id="ProgramMenuDirLev1" On="uninstall" Directory="ProgramMenuDirLev1"/>
</Component>
<Directory Id="dirQueryOutput" Name="QueryOutput">
<Component Id="cmpDirQueryOutput" Guid="{E7841870-CCBE-4186-B586-3DD95017F380}">
<CreateFolder Directory="dirQueryOutput" />
<RemoveFile Id="PurgeQueryOutput" Name="*.*" On="uninstall" />
<RemoveFolder Id="idDirQueryOutputRemove" On="uninstall" Directory="dirQueryOutput" />
</Component>
</Directory>
<Component Id="cmpQueryExe" Guid="*">
<File Id="filQueryExe"
KeyPath="yes"
Vital ="yes"
Source="$(var.SourceDir)\Query.exe">
<!-- Desktop Shortcut -->
<Shortcut Id="PSALERTSQueryDesktopShortcut"
Advertise="yes"
Directory="DesktopFolder"
Name="PSALERTS Query 2015"
WorkingDirectory="INSTALLDIR"
Icon="Query.exe" />
<!-- Add Start Menu Shortcut -->
<Shortcut Id="PSALERTSQueryStartMenuShortcut"
Advertise="yes"
Directory="ProgramMenuDirLev1"
Name="PSALERTS Query 2015"
WorkingDirectory="INSTALLDIR"
Icon="Query.exe" />
</File>
<RemoveRegistryKey Id="RemoveQueryRegKey" Root="HKLM" Key="SOFTWARE\SP Energy Networks\PSALERTS\Query" Action="removeOnUninstall" />
</Component>
<Component Id="cmpQueryPdb" Guid="*">
<File Id="filQueryPdb" KeyPath="yes" Source="$(var.SourceDir)\Query.pdb" />
</Component>
<Component Id="cmpBusinessLogicDll" Guid="*">
<File Id="filBusinessLogicDll" KeyPath="yes" Source="$(var.SourceDir)\BusinessLogic.dll"/>
</Component>
<Component Id="cmpBusinessLogicPdb" Guid="*">
<File Id="filBusinessLogicPdb" KeyPath="yes" Source="$(var.SourceDir)\BusinessLogic.pdb" />
</Component>
<Component Id="cmpBusinessObjectDll" Guid="*">
<File Id="filBusinessObjectDll" KeyPath="yes" Source="$(var.SourceDir)\BusinessObject.dll" />
</Component>
<Component Id="cmpBusinessObjectPdb" Guid="*">
<File Id="filBusinessObjectPdb" KeyPath="yes" Source="$(var.SourceDir)\BusinessObject.pdb" />
</Component>
<Component Id="cmpCommonDll" Guid="*">
<File Id="filCommonDll" KeyPath="yes" Source="$(var.SourceDir)\Common.dll" />
</Component>
<Component Id="cmpCommonPdb" Guid="*">
<File Id="filCommonPdb" KeyPath="yes" Source="$(var.SourceDir)\Common.pdb" />
</Component>
<Component Id="cmpDataAccessDll" Guid="*">
<File Id="filDataAccessDll" KeyPath="yes" Source="$(var.SourceDir)\DataAccess.dll" />
</Component>
<Component Id="cmpDataAccessPdb" Guid="*">
<File Id="filDataAccessPdb" KeyPath="yes" Source="$(var.SourceDir)\DataAccess.pdb" />
</Component>
<Component Id="cmpDPAPIHelperDll" Guid="*">
<File Id="filDPAPIHelperDll" KeyPath="yes" Source="$(var.SourceDir)\DPAPIHelper.dll" />
</Component>
<Component Id="cmpDPAPIHelperPdb" Guid="*">
<File Id="filDPAPIHelperPdb" KeyPath="yes" Source="$(var.SourceDir)\DPAPIHelper.pdb" />
</Component>
<Component Id="cmpLoggerDll" Guid="*">
<File Id="filLoggerDll" KeyPath="yes" Source="$(var.SourceDir)\Logger.dll" />
</Component>
<Component Id="cmpLoggerPdb" Guid="*">
<File Id="filLoggerPdb" KeyPath="yes" Source="$(var.SourceDir)\Logger.pdb" />
</Component>
<Component Id="cmpPSALERTSIni" Guid="*">
<File Id="filPSALERTSIni" KeyPath="yes" Source="$(var.SourceDir)\PSALERTS.ini" />
</Component>
<Component Id="cmpPSALERTSXltm" Guid="*">
<File Id="filPSALERTSXltm" KeyPath="yes" Source="$(var.SourceDir)\PSALERTS.xltm" />
</Component>
<Component Id="cmpPSALERTS2015UserGuideChm" Guid="*">
<File Id="filPSALERTS2015UserGuideChm" KeyPath="yes" Source="$(var.SourceDir)\UserGuide\PSALERTS2015UserGuide.Chm" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<!-- These directories used for Shortcuts -->
<Directory Id="ProgramMenuFolder" Name="PMenu">
<Directory Id="ProgramMenuDirLev1" Name="PSALERTS Query 2015">
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
</Fragment>
<Fragment>
</Fragment>