2015-09-04 139 views
0

我要寄送文件到我们的目标文件夹,创建快捷方式到桌面folder.my威克斯编码 输入代码here`如何在我们的桌面文件夹中发送文件以及如何创建桌面文件夹的快捷方式?

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
    <Product Id="5A157ECF-D387-43EF-855E-C39E9F26B463" Name="DesktopPermission" Language="1033" Version="1.0.0.0" Manufacturer="Naveen" UpgradeCode="5A157ECF-D387-43EF-855E-C39E9F26B463"> 
     <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> 

     <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> 
     <MediaTemplate /> 

     <Feature Id="ProductFeature" Title="DesktopPermission" Level="1"> 
     <ComponentRef Id="compid"/> 
     </Feature> 


    <DirectoryRef Id="APP_DIR"> 
     <Component Id="compid" Guid="F2450B59-EA82-4762-8AEF-984D54F6EAA9"> 
     <File Id="BuildFile" KeyPath="yes" Source="C:\Users\naveen.raja\Desktop\Text.txt"/> 
     </Component> 
    </DirectoryRef> 


    <CustomAction Id="sample" Directory="APP_DIR" Value="C:\Users\naveen.raja\Desktop\Installone" Execute="immediate" /> 

    <Directory Id="TARGETDIR" Name="SourceDir"> 
     <Directory Id="APP_DIR" Name="myfile"> 
     </Directory> 
     </Directory> 

    <Directory Id="TARGETDIR" Name="SourceDir"> 
     <Directory Id="DesktopFolder" Name="Desktop"> 
     <Component Id="ApplicationShortcutDesktop" Guid="258B1044-131B-49F7-90CB-CC92C8658191"> 
      <Shortcut Id="ApplicationDesktopShortcut" 
       Name="Text under your icon" 
       Description="Comment field in your shortcut" 
       Target="[APP_DIR]" 
       WorkingDirectory="APP_DIR"/> 
      <RemoveFolder Id="DesktopFolder" On="uninstall"/> 
      <RegistryValue 
       Root="HKCU" 
       Key="Software/MyAppName" 
       Name="installed" 
       Type="integer" 
       Value="1" 
       KeyPath="yes"/> 
     </Component> 
     </Directory> 
    </Directory> 

    </Product> 


    <Fragment> 
    <InstallExecuteSequence> 
     <Custom Action="sample" Sequence="600" /> 
    </InstallExecuteSequence> 
    </Fragment> 



</Wix> 

但不发货,也不会创建快捷方式的文件。所以请在这个编码中帮助改变所有事情。提前致谢。

回答

1

通常情况下,如果您提供了详细的安装日志,可以更容易地查看到底发生了什么问题。没有那个日志,我只能使用你的代码。

您提供的代码并未为我编译(我正在使用v3.9),并且表单中还存在其他错误,可能会阻止您的安装程序按预期运行。我发现的错误有以下类型:

1:您的自定义操作来设置APP_DIR的位置并未包含在内,因为它的调度片段从未被引用。这将导致文件被安装到C:\ myfile \ Text.txt中(替换C:具有计算机上最大可用空间量的驱动器),而不是按照您的预期在桌面下。 (可能您的文件在那里?)

2:代码失败ICE21,因为ApplicationShortcutDesktop未包含在任何功能中(可能的原因是您的快捷方式未出现)。

3:代码无法编译,因为重复。

4:代码失败ICE 12因为您的自定义操作“sample”的类型为:35.因此它必须在Seq Table中的CostFinalize @ 1000之后出现:InstallExecuteSequence。

备注:通常ProductCode(Product \ @Id)和UpgradeCode(Product \ @Upgrade)不是相同的值。您可能希望在Windows Installer/MSI中了解有关这两个值的更多信息。 wix toolset's wix-users list上有很多这方面的专家。事实上,通过搜索列表档案和/或通过提问可以找到很多帮助。

修复了这四个错误,文件的文件夹和文件夹的快捷方式都显示在指定的桌面上,并且找到该文件添加到该文件夹​​。

这里是我的代码的版本(最小的变化)看起来像:

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
    <Product Id="5A157ECF-D387-43EF-855E-C39E9F26B463" Name="DesktopPermission" Language="1033" Version="1.0.0.0" Manufacturer="Naveen" UpgradeCode="5A157ECF-D387-43EF-855E-C39E9F26B463"> 
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> 

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> 
    <MediaTemplate /> 

    <Feature Id="ProductFeature" Title="DesktopPermission" Level="1"> 
     <ComponentRef Id="compid"/> 
     <ComponentRef Id="ApplicationShortcutDesktop"/> 
    </Feature> 


    <DirectoryRef Id="APP_DIR"> 
     <Component Id="compid" Guid="F2450B59-EA82-4762-8AEF-984D54F6EAA9"> 
     <File Id="BuildFile" KeyPath="yes" Source="C:\Users\naveen.raja\Desktop\Text.txt"/> 
     </Component> 
    </DirectoryRef> 


    <CustomAction Id="sample" Directory="APP_DIR" Value="C:\Users\naveen.raja\Desktop\Installone" Execute="immediate" /> 
    <InstallExecuteSequence> 
     <Custom Action="sample" After="CostFinalize" /> 
    </InstallExecuteSequence> 

    <Directory Id="TARGETDIR" Name="SourceDir"> 
     <Directory Id="APP_DIR" Name="myfile"> 
     </Directory> 
    </Directory> 

    <DirectoryRef Id="TARGETDIR"> 
     <Directory Id="DesktopFolder" Name="Desktop"> 
     <Component Id="ApplicationShortcutDesktop" Guid="258B1044-131B-49F7-90CB-CC92C8658191"> 
      <Shortcut Id="ApplicationDesktopShortcut" 
       Name="Text under your icon" 
       Description="Comment field in your shortcut" 
       Target="[APP_DIR]" 
       WorkingDirectory="APP_DIR"/> 
      <RemoveFolder Id="DesktopFolder" On="uninstall"/> 
      <RegistryValue 
       Root="HKCU" 
       Key="Software/MyAppName" 
       Name="installed" 
       Type="integer" 
       Value="1" 
       KeyPath="yes"/> 
     </Component> 
     </Directory> 
    </DirectoryRef> 

    </Product> 

</Wix> 

希望帮助!

相关问题