我使用此代碼(產品節點內所定義的)的.NET Framwork推出一個簡單的自定義動作維克斯無法啓動自定義動作與4
<!-- Run as admin -->
<Property Id="Privileged" Value="1" />
<!-- .NET Framework must be 4.6-->
<PropertyRef Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED" />
<Condition Message="You must install Microsoft .NET Framework 4.6 or higher.">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED]]>
</Condition>
<Binary Id="Ctav8.CustomAction.CA.dll"
SourceFile="$(var.Ctav8.CustomAction.TargetDir)Ctav8.CustomAction.CA.dll" />
<CustomAction Id="CustomAction1"
Return="check"
Execute="immediate"
BinaryKey="Ctav8.CustomAction.CA.dll"
DllEntry="CustomAction1" />
<InstallExecuteSequence>
<Custom Action="CustomAction1" After="InstallFiles" />
</InstallExecuteSequence>
並且這與它的配置的簡單的自定義動作
public class CustomActions
{
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
session.Message(InstallMessage.Warning, new Record
{
FormatString = "test"
});
return ActionResult.Success;
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
注意:配置文件被稱爲'CustomAction.config',其生成操作被設置爲'內容'。我嘗試將'useLegacyV2RuntimeActivationPolicy'設置爲true和false,但結果仍然相同。
如果我將自定義操作項目的.NET Framework更改爲3.5,此代碼正常工作。
怎麼了?
感謝