我有一个安装程序,它运行一个CustomAction,它运行一个嵌入式powershell脚本来测试各种所需的windows功能的安装状态。这是正确的工作,但它是非常缓慢的完成。
是否有其他方法来测试这些特性?我希望每个功能和子功能都有一些类似于注册表项的东西,但是我还没有找到任何关于这个主题的文档。
发布于 2013-09-27 00:32:29
最后,我使用了一个(现在已删除)的建议来使用托管DTF自定义操作来查询C#中的服务器特性。
[CustomAction]
public static ActionResult CheckFeatures(Session session)
{
SelectQuery q = new SelectQuery("Win32_ServerFeature");
ManagementObjectSearcher s = new ManagementObjectSearcher(q);
foreach (ManagementObject e in s.Get())
{
if((UInt32)e["ID"] == FeatureId)
{
session["FeatureIsSet"] = "1";
}
}
}
<CustomAction Id="CACheck" BinaryKey="CA" DllEntry="CheckFeatures"
Execute="immediate" Return="check" />
<Binary Id="CA" SourceFile="path/to/bin" />发布于 2013-09-25 06:24:38
在其中一个安装项目中,我们使用dism.exe来启用所需的Windows功能。
例如,在IIS 8中启用ASP.NET是通过以下自定义操作完成的:
<!-- 32-bit edition of Windows knows where to find dism.exe -->
<Property Id="DISMEXEPATH" Value="dism.exe" />
<!-- 64-bit edition of Windows requires this workaround to get proper dism.exe version -->
<SetProperty Id="DISMEXEPATH" Value="[WindowsFolder]Sysnative\dism.exe" After="AppSearch">VersionNT64</SetProperty>
<!-- And the CA to do the job (with the help of [quiet execution CA][2]) -->
<CustomAction Id="SetForEnableAspNetIIS8" Property="EnableAspNetIIS8" Value=""[DISMEXEPATH]" /norestart /quiet /online /enable-feature /featurename:IIS-ApplicationDevelopment /featurename:IIS-ASPNET45 /featurename:IIS-NetFxExtensibility45 /featurename:NetFx4Extended-ASPNET45 /featurename:IIS-ISAPIExtensions /featurename:IIS-ISAPIFilter" />
<CustomAction Id="EnableAspNetIIS8" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check"/>这似乎不是一个好的实践,但它对该项目有效。
https://stackoverflow.com/questions/18992363
复制相似问题