New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CopyFile with no FileId results in broken MSI #5867

Open
tcostin opened this Issue Aug 23, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@tcostin
Copy link

tcostin commented Aug 23, 2018

If a component has a CopyFile element that does not specify a FileId, the resulting MSI is not usable.

I am including some images as part of the installation package but I need them installed to a different folder. Here is my wxs snippet:

<Directory Id="ProgramFilesFolder">
   <Directory Id="CompanyFolder" Name="MyCompany">
       <Directory Id="INSTALLFOLDER" Name="MyProduct">
             <Directory Id="ImagesFolder" Name="images" />
        </Directory>
     </Directory>
</Directory>

<Component Id="ProductComponent" Directory="INSTALLFOLDER">
 <File Source = "(BuildDir)MyProductExe.exe" />
 <File Source = "(BuildDir)images\image1.bmp" />
 <File Source = "(BuildDir)images\image2.bmp" />
 <CopyFile Id="MoveBmp" Delete="yes" SourceName="*.bmp" DestinationDirectory="ImagesFolder"/>
</Component>

I am able to compile the MSI project and the msi and cab file are created successfully. But when I try to install the MSI, I get error 2716 from Windows Installer. Added some snippets from msi verbose log:

Action start 22:17:55: FileCost.
MSI (c) (5C:78) [22:17:55:111]: Note: 1: 2205 2: 3: MsiAssembly
MSI (c) (5C:78) [22:17:55:111]: Note: 1: 2716 2: ProductComponent
MSI (c) (5C:78) [22:17:55:111]: Note: 1: 2205 2: 3: Error
MSI (c) (5C:78) [22:17:55:111]: Note: 1: 2228 2: 3: Error 4: SELECT Message FROM Error WHERE Error = 2716
DEBUG: Error 2716: Couldn't create a random subcomponent name for component 'ProductComponent'.
MSI (c) (5C:20) [22:17:55:115]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

MSI (c) (5C:78) [22:17:57:167]: Note: 1: 2205 2: 3: Error
MSI (c) (5C:78) [22:17:57:167]: Note: 1: 2228 2: 3: Error 4: SELECT Message FROM Error WHERE Error = 1709
MSI (c) (5C:78) [22:17:57:167]: Product: (MyProduct) -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2716. The arguments are: ProductComponent, ,

Action ended 22:17:57: FileCost. Return value 3.
Action ended 22:17:57: INSTALL. Return value 3.

If I remove the element, the MSI installs successfully.

Windows 7.1 [x64] & .Net 4.7.2
WiX Toolset v3.11 (3.11.2318.0)
VS 2017.8.1 & WiX Extension 0.9.21

@barnson barnson added this to the v4.0 milestone Sep 13, 2018

@barnson

This comment has been minimized.

Copy link
Member

barnson commented Sep 13, 2018

Workaround: Specify SourceDirectory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment