1

I have built a simple MSI file with WixTool 3.10.
One of the feature is to copy a file which already exists on host.
Everything is working fine when I install this msi through Remote Desktop.
However if I login through SSH and run this MSI, the file doesn't get copied.
Here's a simplified version of my wxs file:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="my product" Language="1033" Version="1.0" Manufacturer="Allen" 
           UpgradeCode="PUT-GUID-HERE">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    <MediaTemplate EmbedCab="yes" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="My Folder">
        </Directory>
      </Directory>
    </Directory>

    <Property Id="FILEA">
      <DirectorySearch Id="SearchSourceDir" Path="[SOURCEDIR]">
          <FileSearch Name="fileA.txt" />
      </DirectorySearch>
    </Property>

    <Component Id="cmpCopyFile" Guid="*" Directory="INSTALLFOLDER">
      <CopyFile Id="CopyFileA" SourceProperty="FILEA" DestinationProperty="INSTALLFOLDER"/>
    </Component>

    <Feature Id="FeatureCopyFile" Title="Copy file" Level="1">
      <ComponentRef Id="cmpCopyFile" />
    </Feature>
  </Product>
</Wix>

And here's the command I used for install:

msiexec /i test.msi /l*v install.log

Inside the log I can see the feature and component gets installed, however the file didn't get copy.
Is this the expected behavior? Any help or advice is appreciated.

Update: Here are the logs for local install and remote install install_local.log install_remote.log

Allen Chen
  • 11
  • 4
  • The obvious question is what is in this file, if it can be installed by some other and more reliable mechanism - for example if it is an XML or INI file. – Stein Åsmul Aug 16 '18 at 04:41
  • @SteinÅsmul it's a plain text config file, whilch will be shipped together with the msi installer in a zip file. – Allen Chen Aug 16 '18 at 20:25
  • Added some comments and suggestions below. I am unfamiliar with the use of SSH for this purpose. I am not sure how it operates. – Stein Åsmul Aug 16 '18 at 22:36
  • I tried to modify the chat room access to allow you to enter, but still no luck. – Stein Åsmul Aug 22 '18 at 20:09

2 Answers2

1

SecureCustomProperties: The remote install is silent and the client one is interactive? This could affect the availability of the APPSEARCH property in deferred / silent mode.

You need to mark properties secured in order to have them pass from client- (GUI) to server process (Install). Could you please try to change this in your WiX source and recompile:

Current:

<Property Id="FILEA">

Updated:

<Property Id="FILEA" Secure="yes">

Then recompile and test install.


Alternatively you can modify or "hotfix" the SecureCustomProperties property in your current MSI file to include FILEA. That involves prefixing the current value for SecureCustomProperties with FILEA along these lines:

FILEA;NETFRAMEWORK20;WIX_DOWNGRADE_DETECTED;WIX_UPGRADE_DETECTED

If you recompile the MSI from the WiX source this will be done for you - obviously. Adding this in case the source won't compile with the Secured attribute specified.


Apart from that, this looks odd from the local log file:

PROPERTY CHANGE: Adding FILEA property. Its value is 'C:\Users\tetter\fileA.txt\'.

But let us see if the above solves the problem.


Avoid File Copy?: What SSH client? Never tried to deploy MSI via SSH. Not 100% match, but maybe read my answer on the issue of config files and settings management. It would very likely be more reliable to install the file by more robust means - as you can clearly see from the current problems. For example by using the IniFile table or to use WiX's XML writing capabilities.

Application Download: To be honest, why not download these settings from a database or from a UNC path directly from your application? Should save you any deployment issues, and you have better debugging abilities (debugging in real-time on test computers, no "one-shot" deployment problems to have limited debugging ability to investigate), and you can ensure that all clients have the latest settings provided they can access the UNC path? Just an idea.

Cause: If I was to theorize on the cause, I would say your MSI runs in your admin context via Remote Desktop with access to your login context and access token and hence have rights on the share. When you kick off the MSI from SSH it might run in system context, with no network access at all - or very limited. Just a guess.

Stein Åsmul
  • 34,628
  • 23
  • 78
  • 140
  • The reason of using SSH is to fit my current testing infra. Which contains mostly Linux machines. I've setup a bitvise ssh server on the target Windows machine. – Allen Chen Aug 17 '18 at 00:43
  • Sounds like I would have a lot of questions for you on Linux / Windows interchangeability challenges. I'll have to wait for your blog :-). Reading the above again I don't think it will help you much. It is odd that the file does not get copied and the MSI completes. Did you search the drive for the file in question? Maybe it ended up somewhere else? Maybe check root of C:\ and the system folder first? [**Some tips for interpreting MSI log files**](https://stackoverflow.com/a/49028367/129130). – Stein Åsmul Aug 17 '18 at 00:48
  • I just tested it again, the file didn't get copy to other folders. I can see there's big difference between two install logs, however can't really tell what's the root cause for this issue. I'd appreciate if you could take a look at the logs I just upload. – Allen Chen Aug 17 '18 at 01:53
  • Are you running on **VirtualBox** / **Wine** or something like that? It looks like the directory resolution is very messed up in what you have marked as the local install (maybe you mixed the logs up?). I have never seen anything like this I am afraid. Not quite sure what is happening. Example: `SHELL32SHGetFolderPath returned CUserstetterAppDataRoaming`. The directory separators or slashes are missing. – Stein Åsmul Aug 17 '18 at 02:20
  • Yes this is a virtual machine running on VMware ESXi, however I'm able to see the slashes without issues. `SHELL32::SHGetFolderPath returned: C:\Users\tetter\AppData\Roaming`. Maybe I should put the logs somewhere else? – Allen Chen Aug 17 '18 at 02:39
  • Hold on, while I check here. Could be a copy issue as you say. I had some problems opening the raw files link (GIT cache server error message), so I copy / pasted. Must be the issue. Looks like the local file was saved as ANSI at some point - that would explain the missing characters I guess. MSI logs are Unicode. – Stein Åsmul Aug 17 '18 at 02:47
  • Please check my updated answer. Why do you run in silent mode remotely? I guess I don't understand 100% how this is set up. – Stein Åsmul Aug 17 '18 at 03:25
  • I've tried the Secure attribute but it still doesn't work :( I think there's definitely some issue with my setup, the user I login with SSH might have different privilege. – Allen Chen Aug 18 '18 at 00:03
  • What kind of shell does SSH allow? Just command line? Sorry, I am not up to speed with what is new here. – Stein Åsmul Aug 18 '18 at 00:14
  • Before doing anything else, would you mind reading [**my answer on settings management**](https://stackoverflow.com/questions/51852231/add-a-config-file-to-an-installer-msi) that I linked to before? I think you need a new solution I am afraid. I smell a terrible time drain for you otherwise. There are so many unknowns... Linux, Windows, VMWare, SSH, MSI, etc... layer upon layer. Just thinking out loud... – Stein Åsmul Aug 18 '18 at 00:23
  • Thanks, I'll take a look carefully. For Bitvise SSHD it has command prompt ,powershell, and a few more. – Allen Chen Aug 18 '18 at 00:29
  • And just so it is clear; this is where you kick off the installation that fails from? In a connection to a Windows box that runs on VMWare? Are you connecting from Linux or Windows? Just out of curiosity? – Stein Åsmul Aug 18 '18 at 00:32
  • I'm connecting from my Windows laptop. I've also tried from another Linux box and got the same issue. – Allen Chen Aug 18 '18 at 00:34
  • Please see if you can join this: https://chat.stackoverflow.com/rooms/178232/msi-ssh – Stein Åsmul Aug 18 '18 at 00:36
  • aw it says I need 20 reputation to talk in chat room :( – Allen Chen Aug 18 '18 at 00:38
  • Oh, all kinds of problems. Sorry, not much I can do about that except upvote your question - which I already did. Tried to make you the room owner. Did not work. – Stein Åsmul Aug 18 '18 at 00:42
0

It might make a difference if you use the correct name for the case-sensitive source property, which is SourceDir

https://msdn.microsoft.com/en-us/library/windows/desktop/aa371857(v=vs.85).aspx

PhilDW
  • 19,260
  • 1
  • 14
  • 23