SystemTools:TemplateFile - actually possible to overwrite? to execute on uninstall?

117 views
Skip to first unread message

Overand

unread,
Feb 12, 2016, 5:31:50 AM2/12/16
to msiext
Holy smokes I've been at his particular thing for a long time.

First off - what I'm trying to do is use a template for a config file "kinda like an INI file" but not actually the correct format.  I have that more or less working, but I end up dumping a .template file into my actual deployed application, and not removing my .conf file when uninstalling.

First - I tried to do an 'in-place" edit, per the docs saying: 
   string Wix::Extensions::SystemTools::TemplateFile::Target

      Target file to be written. When omitted, the source file is processed in-place and overwritten.


But my attempts to do so, when built with the CLI tools:


Test MSI Installer.wxs

candle.exe : error CNDL0001 : Cannot set column 'Target' with a null value because this is a required field.


Exception Type: System.InvalidOperationException


Stack Trace:

   at Microsoft.Tools.WindowsInstallerXml.ColumnDefinition.ValidateValue(Object value)

   at AppSecInc.Wix.Extensions.SystemToolsCompiler.ParseTemplateFileElement(String componentid, XmlElement node)

   at AppSecInc.Wix.Extensions.SystemToolsCompiler.ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, String[] contextValues)

   at Microsoft.Tools.WindowsInstallerXml.CompilerExtension.ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, String& keyPath, String[] contextValues)

-- SNIP --



Shooting in the dark, I tried to enable "ExecuteOnUninstall" as well, and got the following:


: error CNDL0004 : The SystemTools:TemplateFile element contains an unexpected attribute 'ExecuteOnUninstall'.


Am I doing something wrong?  Are the docs simply incorrect?  Is there a (sane?) way to do this?  I'm really hoping to not have to debug VBS files like the last iteration of this installer forced me to do.


MSIEXT 1.5 (From release, not compiled from source)
Wix Toolset 3.10.2.2516


Snippet follows. (pastebinish thing at http://sprunge.us/bfJV?xml may be nicer to look at)


<ComponentGroup Id="Configuration" Directory="ConfigurationFolder">
      <Component Id="DummyToolConfiguration" Guid="*">
<File Id="DummyToolConfigurationFile" Name="dummytool.conf.template" Source="$(var.TemplatePath)\dummytool.conf.template"/>
<SystemTools:TemplateFile Id="DummyToolConfigurationFile_component" Source="[#DummyToolConfigurationFile]"  ExecuteOnInstall="yes"> <!-- Target="[ConfigurationFolder]\dummytool.conf" -->
<SystemTools:TemplateFileProperty Id="INCLUDECONFDIR_property" Name="INCLUDECONFDIR" Value="INSERTsomeGARBAGEdataHERE" />
<SystemTools:TemplateFileProperty Id="FILENAME_property" Name="Filename" Value="dummytool.conf" />
</SystemTools:TemplateFile>
      </Component>
</ComponentGroup>

Help!

--Overand

Overand

unread,
Feb 12, 2016, 5:39:43 AM2/12/16
to msiext
-been at *this particular thing -

Update - issue persists on Wix toolkit 3.8 rather than 3.10.

Daniel Doubrovkine

unread,
Feb 12, 2016, 3:46:28 PM2/12/16
to msi...@googlegroups.com
ExecuteOnUnInstall is spelled with a capital I :) it's definitely supported, master/src/WixExtensions/SystemToolsExtension/wixext/Xsd/SystemTools.xsd#L546. So lets start there, what's the next problem you have after you fix that?

--
You received this message because you are subscribed to the Google Groups "msiext" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msiext+un...@googlegroups.com.
To post to this group, send email to msi...@googlegroups.com.
Visit this group at https://groups.google.com/group/msiext.
For more options, visit https://groups.google.com/d/optout.



--

Overand

unread,
Feb 16, 2016, 12:59:23 AM2/16/16
to msiext
Above that issue is one that I'm still having, though I at least have a working installer now - and thanks for the correction!

The issue I mentioned above is when I attempt to edit a file "inline" by omitting the target - I get an error: "candle.exe : error CNDL0001 : Cannot set column 'Target' with a null value because this is a required field."

Is there an example of an inline replacement?  (Or at least a replacement that won't leave me with a file that is untracked by the installer system, without a residual template file?)

Daniel Doubrovkine

unread,
Feb 16, 2016, 8:45:29 AM2/16/16
to msi...@googlegroups.com
Did you try to use the same source and target name?

I think this is a bug ... ahem ... feature request. You should open it in https://github.com/dblock/msiext/issues and contribute :)

Another possible way to deal with it is to add a DeleteFile on uninstall. 

<AppSecInc:DeleteFile Id="DeleteAlwaysOnUnInstall" File="[INSTALLLOCATION]SystemToolsMsi_CopyAlways.wxs" DeleteOnUnInstall="yes" CheckIfExists="yes" />

Overand

unread,
Feb 18, 2016, 12:24:45 PM2/18/16
to msiext
Deleting the (leftover .template) file would be better in this use case, as I'd rather not leave it laying around, but that's the file that's actually managed, so I dunno!  (Hence me wanting to get the inline file replacement working).

And yeah, setting source and target to the same file also fails with a build-time error.  I'll get on that bug/feature (; report soon!


On Friday, February 12, 2016 at 5:31:50 AM UTC-5, Overand wrote:
Reply all
Reply to author
Forward
0 new messages