Reputation: 1
I want to ship file to our target folder and create shortcut to desktop folder.my wix coding is enter code 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>
but the file not shipped and also not created the shortcut. so please help what are all things to change in this coding. Thanks in advance.
Upvotes: 0
Views: 103
Reputation: 376
Normally, if you provide a verbose log of your installation, it makes it easier to see exactly what went wrong. Without that log, I had to go with your code only.
Your code as provided didn't compile for me (I am using v3.9), and there were other errors in form probably preventing your installer from running as you intended. The errors I found were of the following types:
1: your custom action to set the location of APP_DIR wasn't ever included because the fragment scheduling it was never referenced. That would cause the file to be installed to C:\myfile\Text.txt (replace C: with the drive with the largest amount of free space on your computer) instead of under your desktop as you intended. (May your file be there?)
2: Code failed ICE21 because ApplicationShortcutDesktop wasn't included in any feature (probable reason that your shortcut didn't appear).
3: Code couldn't compile because was repeated.
4: Code failed ICE 12 because your custom action "sample" is of type: 35. Therefore it must come after CostFinalize @ 1000 in Seq Table: InstallExecuteSequence.
A side note: Normally ProductCode (Product\@Id) and UpgradeCode (Product\@Upgrade) are NOT the same value. You may wish to learn more about those two values in Windows Installer/MSI. There are a lot of experts in this area on the wix toolset's wix-users list. In fact, a lot of help can be found by searching that lists archives and/or by asking questions there.
Fixing these four errors, your file's folder and your shortcut to the file's folder both showed up on the indicated desktop, and the file was found added to that folder.
Here's what my version (minimal changes) of your code looks like:
<?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>
Hope that helps!
Upvotes: 1