[英]Stylecop for InstallShield project
我需要确保InstallShield仅允许设置。 我想在CI服务器上运行此检查。
换句话说,在“ Component
表”中,我想检查“ Attributes
字段仅具有允许的值( <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>
直接的方法是创建PowerShell脚本,以将项目文件解析为XML,找到相应的值,并确保它们在允许的范围内。
有没有像StyleCop这样的工具更优雅的方式做到这一点? 作为自定义的PowerShell脚本,要单独支持它会很昂贵。
感谢Steve的评论,我可以使用PowerShell
版本,而无需手动解析InstallShield
项目文件。
使用自动化接口检查组件的错误配置非常容易。
$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()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.