简体   繁体   中英

Stylecop for InstallShield project

I need to make sure that InstallShield has only allowed settings. I would like to run this check on CI server.

In other words in Component table I would like to check Attributes fields has only allowed values( <td>8</td> , <td>1</td> )

<table name="Component">
    <col key="yes" def="s72">Component</col>
    <col def="S38">ComponentId</col>
    <col def="s72">Directory_</col>
    <col def="i2">Attributes</col>
    <col def="S255">Condition</col>
    <col def="S72">KeyPath</col>
    <col def="I4">ISAttributes</col>
    <col def="S255">ISComments</col>
    <col def="S255">ISScanAtBuildFile</col>
    <col def="S255">ISRegFileToMergeAtBuild</col>
    <col def="S0">ISDotNetInstallerArgsInstall</col>
    <col def="S0">ISDotNetInstallerArgsCommit</col>
    <col def="S0">ISDotNetInstallerArgsUninstall</col>
    <col def="S0">ISDotNetInstallerArgsRollback</col>
        <row>
            <td>Adapter</td>
            <td>{05A86BD3-38F8-40CC-8A16-AB643A555787}</td>
            <td>ADAPTER</td>
            <td>8</td>
            <td/>
            <td>adapter.dll</td>
            <td>1</td>
            <td/>
            <td/>
            <td/>
            <td>/LogFile=</td>
            <td>/LogFile=</td>
            <td>/LogFile=</td>
            <td>/LogFile=</td>
        </row>

The straightforward approach would be create PowerShell script to parse the project file as XML, find corresponding values, and make sure they are in allowed range.

Is there more elegant way to do so like tool similar to StyleCop? As custom PowerShell script would be expensive to support by its own.

Thanks to comment from Steve I got working PowerShell version without need to manually parse InstallShield project file.

Using Automation Interface It is quite easy to check a component for errorneous configuration.

$projectFile = "project.ism"

$project = new-object -comobject IswiAuto16.ISWiProject

$project.OpenProject($projectFile)

Foreach ($feature in $project.ISWiFeatures)
{
    Foreach ($component in $feature.ISWiComponents)
    {
        if(<check $component  for an errorneous config>)
        {
            <report an issue here>
        }
    }
}

$project.CloseProject()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM