0

Currently I am migrating my wix setup from wix v3.11 to wix v 4.0 i have used the command WIX Convert <setup.myapp>.wxs while using this above command i am getting an error in my msi file that

 error WIX0005: The Fragment element contains an unexpected child element 'Merge'.

in particular line where i have used this code

<Fragment>
 <DirectoryRef Id="TARGETDIR">
  <Merge Id="_M_myBase" SourceFile="$(var.SourceDir)\Merge.myBase.msm" DiskId="1" Language="1033" />
  <Merge Id="_M_myService" SourceFile="$(var.SourceDir)\Merge.myService.msm" DiskId="1" Language="1033" />
  <Component Id="_COMP_Viewer_exe" Guid="{2809A717-49AF-0429-7DD4-AEDD42DB4292}">
   <File Id="_FILE_Viewer_exe" Name="Viewer.exe" KeyPath="yes" Assembly=".net" AssemblyManifest="_Viewer_exe" AssemblyApplication="_Viewer_exe" DiskId="1" Source="$(var.SourceDir)\Viewer.exe" />
   <Shortcut Id="_F5F26CA032AC4A2D86A378B0EEDB6B42" Directory="_DIR_StartMenu_ProductFolder" Name="Device Viewer" Icon="Device.ico" IconIndex="0" Show="normal" Advertise="yes" />
  </Component>
 </DirectoryRef>
</Fragment>

1 Answers1

0

Merge can only be a child of a directory, in both WiX v3 (Directory, DirectoryRef) and v4 (Directory, DirectoryRef, StandardDirectory).

Bob Arnson
  • 21,377
  • 2
  • 40
  • 47
  • yes @Bob Arnson you are correct , i have updated my question, while doing `wix convert` it gave me a error `D:\Setup.myapp.wxs : error WIX0070: A reference to the TARGETDIR Directory was removed. This can cause unintended side effects. See the conversion FAQ for more information: https://wixtoolset.org/docs/fourthree/faqs/#converting-packages (TargetDirRefRemoved)` and updated the component section with a Directory attribute `` then how to define a `Directory` and its id in the top of `Merge` – Aditya Dalai Jul 11 '23 at 18:27
  • `TARGETDIR` is rarely a good installation directory. I recommend using `StandardDirectory` to pick one like `ProgramFiles6432Folder`. Then `Merge` can go under that. – Bob Arnson Jul 11 '23 at 20:29