At the moment I'm offering both a attended and unattended version of the installer I'm creating. As part of the initializationActionList I'm detecting the version of .NET installed and using the dotnet_autodetected variable to display a page later on to prompt the user to install .NET if it isn't present. This of-course doesn't work in the unattended mode, so I've added the following to my initializationActionList to throw an error when we're doing the installation on Windows, in an unattended mode, without .NET present.

This works fine as it stands, but part of the reason for the unattended installation is for use via Group Policy. So my question is instead of throwing the error message can I simply log this message out to the installation log and still abort the installation?

I've had a look through the questions but can't find anything to help at the moment.

Thanks, Adam

<initializationActionList>
    <!-- Set the min and max version of .NET supported -->
    <setInstallerVariable name="dotNetRequired" value="4.0"/> 
    <setInstallerVariable name="dotNetMax" value="4.5"/>

    <autodetectDotNetFramework  abortOnError="0" showMessageOnError="0">
        <validDotNetVersionList>
            <validDotNetVersion>
                <frameworkType>any</frameworkType>
                <maxVersion>${dotNetMax}</maxVersion>
                <minVersion>${dotNetRequired}</minVersion>
            </validDotNetVersion>
        </validDotNetVersionList>
    </autodetectDotNetFramework>

    <throwError text="You must install a version of .NET between ${dotNetRequired} and ${dotNetMax} before attempting to install ${project.shortName}">
        <ruleList>
            <platformTest type="windows"/>
            <compareText text="${installer_ui}" logic="equals" value="unattended" />
            <isFalse value="${dotnet_autodetected}"/>
        </ruleList>
    </throwError>
</initializationActionList>

asked 23 Jan '13, 06:17

A%20Jefferiss's gravatar image

A Jefferiss
56151621
accept rate: 100%


You could use the below code:

<actionGroup>
    <actionList>
          <logMessage>
             <text>You must install a version of .NET between ${dotNetRequired} and ${dotNetMax} before attempting to install ${project.shortName}</text>
          </logMessage>
          <exit/>
    </actionList>
    <ruleList>
        <platformTest type="windows"/>
       <compareText>
          <text>${installer_interactivity}</text>
          <logic>does_not_equal</logic>
          <value>normal</value>
       </compareText>
        <isFalse value="${dotnet_autodetected}"/>
    </ruleList>
</actionGroup>

Please also note I change the check used to determine if the installer is running in unattended mode so it also works when using --unattendedmodeui minimal or --unattendedmodeui minimalWithDialogs

link

answered 23 Jan '13, 07:07

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

The installer is exiting like I would expect, but I'm not getting any log files. Do you have any idea why?

I've set installationLogFile to ${installer_directory}/${project.shortName}-InstallLog.log should would have thought the log would appear in the same directory as the installer...

(23 Jan '13, 08:53) A Jefferiss

Putting a writeFile entry in works however:

<writeFile text="You must install a version of .NET between ${dotNetRequired} and ${dotNetMax} before attempting to install ${project.shortName}" path="${installer_directory}/test.log" />
(23 Jan '13, 09:03) A Jefferiss

The log should have been moved from /tmp to the configured location when exiting, we will check it on our side.

(23 Jan '13, 11:09) juanjo ♦♦

Excellent thanks, I can see the installer log in the temp directory for the user, with the expected log entry...can't see any reason why it should copy (it has the same permission as other files).

(25 Jan '13, 12:32) A Jefferiss
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×44
×36
×26
×13

Asked: 23 Jan '13, 06:17

Seen: 4,005 times

Last updated: 25 Jan '13, 12:32