Default InstalledCheck on MSIComponent?

Jul 30, 2010 at 2:35 PM
For uninstall, a installedcheck is needed. for MSI the first idea is to check for the productcode. Now my idea is if it could be possible to make this a default installedcheck for msicomponents since the product code can be obtained from the msi itself?
Coordinator
Jul 30, 2010 at 8:37 PM

If you were to do that at runtime, it would require the MSI to be extracted to be opened, or opened from within the executable. That is wasteful and can take a long time. With a download scenario it's much worse (download would have to happen before you hit install).

Lets imagine we can do something at runtime. I can't see a nice obvious way to cleanly connect an embedded MSI (or any MSI for that matter) to the component. Embedding can take as many files as you want, then the MSI may not exist yet if you're not embedding everything together, etc.

Thanks for the idea though! Maybe you can solve both of my problems above and implement a feature? :)

Aug 2, 2010 at 11:55 AM
Edited Apr 5, 2011 at 11:07 AM

I do not have the download scenario so I left this out ;) That's of course difficult, or a "timekiller", during runtime. I thought off a "creation time" scenario, where the MSI file is available. They it should be possible to read the productcode (and version) out of the MSI and add it as a installed check to the component. But I do not know if this get's difficult in some cases also ...

Coordinator
Aug 2, 2010 at 7:27 PM

Generally, I recommend approaching installers and bootstrappers as valid build targets at an equal level. We, typically, generate a version (in MSBuild, ANT, etc.) based on SVN revision and then inject it into the MSI and into the bootstrapper at compile time. For the MSI we generate a version.wxi file with a version defined and for the bootstrapper, we use the configuration.xml as a template and render variables in it, then invoke InstallerLinker. You might get some good ideas from here.

 

Aug 3, 2010 at 6:18 AM
thanks for the answer and the reference to you blog about versioning scheme, think we will somehow do the same process one time.You also mentioned that you render variables in the configuration.xml file, could you just give an example since I have found no reference ,except for ui controls, of this in the help file so far? Thanks for the help so far.
Coordinator
Aug 3, 2010 at 11:05 AM

We use TemplateFile command from MSBuild Communityt Tasks or ANT's copy.

MSBuild (you can specify any variable from AssemblyInfoTokens as $(Variable):

    <CreateItem Include="BuildNumber" AdditionalMetadata="ReplacementValue=$(Major).$(Minor).$(Revision).$(Build)"><Output TaskParameter="Include" ItemName="AssemblyInfoTokens"/></CreateItem>
    <CreateItem Include="Configuration" AdditionalMetadata="ReplacementValue=$(Configuration)"><Output TaskParameter="Include" ItemName="AssemblyInfoTokens"/></CreateItem>
    <TemplateFile Template="Configuration.xml" OutputFilename="Build\Configuration.xml" Tokens="@(AssemblyInfoTokens)"/>

ANT (you can specify any variable with ${variable} in configuration.xml):

<copy file="configuration.xml" tofile="${build.dir}/configuration.xml" overwrite="true">
<filterchain>
  <expandproperties />
</filterchain>
</copy>

Invoke InstallerLinker on the output configuration.xml.

Aug 4, 2010 at 6:10 AM

thanks for the sample, I will give it a try and report the results.
Thanks for the patience.