tags:

views:

35

answers:

1

I am trying to create an MSI package that uses the AppCmd application to configure IIS7. It only has to execute some commands that call AppCmd. Some commands need to be called when installing, other commands need to be called when uninstalling.

Here is what I have now:

I have a property that points to AppCmd:

<Property Id="APPCMD" Value="C:\Windows\system32\inetsrv\appcmd.exe" />

I have my custom actions:

<CustomAction Id="UnlockHandlerSection" Return="check" Property="APPCMD" ExeCommand="unlock config /section:system.webServer/handlers" />

I have Custom elements that call the actions:

<InstallExecuteSequence>
    <Custom Action="UnlockHandlerSection" After="InstallFiles">NOT Installed AND NOT PATCH</Custom>
<InstallExecuteSequence>

The problem with this is is that the commands are not called when I try to install the resulting MSI package. If I log the installation, the log itself doesn't have a lot of information in it. I don't wanna post the whole thing, but it ends with this:

MSI (c) (50:34) [12:35:47:703]: Product: Server Configuration 1.0.0 -- Installation failed.
MSI (c) (50:34) [12:35:47:703]: Windows Installer installed the product. Product Name: Server Configuration 1.0.0. Product Version: 1.0.0. Product Language: 1033. Installation success or error status: 1603.

Also, just before my APPCMD property is initialized, this is what is printed (are the return values here correct?):

Action ended 12:35:47: ExecuteAction. Return value 3.
Action ended 12:35:47: INSTALL. Return value 3.
Property(C): APPCMD = C:\Windows\system32\inetsrv\appcmd.exe

Could anyone please advise me on what I am doing wrong? Thank you!

A: 

The solution was to add an empty component:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Component Id="EmptyComponent" Guid="BDA7567B-2878-4A6C-A122-7699ACC35970" />
</Directory>

The next step was to include that empty component in a feature:

<Feature Id="Feature" Title="Feature" Level="1">
    <ComponentRef Id="EmptyComponent" />
</Feature>

After adding these two bits, the commands are called correctly.

Sevas

related questions