按功能执行自定义操作

发布于 2024-09-06 23:07:19 字数 104 浏览 4 评论 0原文

我编写了一个自定义操作来在安装后创建计划任务。 当用户不想创建计划任务时,我不希望运行自定义操作。在安装过程中,即使我选择“功能将不可用”,schtask 也会被创建。如何阻止自定义操作执行?

I wrote a custom action to create a scheduled task after install.
I do not want the Custom Action to run when the user does not want to create the schedule task. During installation even if I select " Feature will be unAvailable" the schtask is getting created. How do i prevent the Custom Action from executing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

好久不见√ 2024-09-13 23:07:19

您可以为 CA 执行设置一个条件:

<InstallExecuteSequence>
    <Custom Action="ScheduleTaskCA" After="InstallFinalize">
        <![CDATA[&feature_name=3]]>
    </Custom>
</InstallExecuteSequence>

希望有帮助。

如果您想了解有关 CA 条件的更多信息,可以查看下面的链接。
高级自定义操作条件

You can set a condition for your CA execution:

<InstallExecuteSequence>
    <Custom Action="ScheduleTaskCA" After="InstallFinalize">
        <![CDATA[&feature_name=3]]>
    </Custom>
</InstallExecuteSequence>

Hope it helps.

If you want to read more about CAs conditions, you can chech the link below.
Advanced Custom Action Conditions

乙白 2024-09-13 23:07:19

添加到您的安装执行序列。

Add to your Install execute sequence.

空宴 2024-09-13 23:07:19

其实我发现了问题所在。 &FeatureName = 3 告诉我要安装该功能,与此相反的是 !FeatureName = 3,这意味着该功能已经安装。这解决了我的问题,所以最终的解决方案变成了

&FeatureName = 3 OR (!FeatureName  = 3 AND NOT (Uninstalling OR MSIPATCHREMOVE OR RemovingForUpgrade)    

Actually I found out the problem. The &FeatureName = 3 tells me that the feature is to be installed, and the opposite to that, is !FeatureName = 3, which means the feature is installed already. This fixed my problem so the final solution became

&FeatureName = 3 OR (!FeatureName  = 3 AND NOT (Uninstalling OR MSIPATCHREMOVE OR RemovingForUpgrade)    
那片花海 2024-09-13 23:07:19

“MyService”是功能名称

“FEATURE_MyService”是我的条件名称:我正在使用复选框来设置 FEATURE_MyService 属性的值

<Control Id="Chk1" Type="CheckBox" Height="12" Width="110" X="50" Y="199" Text="Portal Windows Service" Property="FEATURE_MyService" CheckBoxValue="0" Hidden="yes">

<Custom Action='CAction1' After="InstallExecute">
    NOT Installed AND <![CDATA[(&MyService=3)]]>

<Custom Action='CAction2' Before='InstallExecute'>
    <![CDATA[(&MyService=3 AND NOT Installed)]]>

<Custom Action='CAction3' After='InstallFinalize'>
    <![CDATA[FEATURE_MyService AND NOT Installed ]]>

"MyService" is feature Name

"FEATURE_MyService" is my condition Name: I am using checkbox to set the value of FEATURE_MyService property

<Control Id="Chk1" Type="CheckBox" Height="12" Width="110" X="50" Y="199" Text="Portal Windows Service" Property="FEATURE_MyService" CheckBoxValue="0" Hidden="yes">

<Custom Action='CAction1' After="InstallExecute">
    NOT Installed AND <![CDATA[(&MyService=3)]]>

<Custom Action='CAction2' Before='InstallExecute'>
    <![CDATA[(&MyService=3 AND NOT Installed)]]>

<Custom Action='CAction3' After='InstallFinalize'>
    <![CDATA[FEATURE_MyService AND NOT Installed ]]>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文