我找不到如何引用本地字符串并在自定义操作中更改其值。
我正在尝试:
public static ActionResult ReturnPathCCS(Session session)
{
session["!(loc.StartPathCCS)"] = @"C:\";
session["!(loc.StartPathServices)"] = @"D:\";
return ActionResult.Success;
}
Resources.wxl:
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="StartPathCCS" Overridable="yes">C:\Program Files\</String>
<String Id="StartPathServices" Overridable="yes">C:\Program Files\</String>
</WixLocalization>
自定义操作:
<Property Id="StartPathCCSProp" Value="!(loc.StartPathCCS)"></Property>
<Binary Id="PathCustomAction" SourceFile="$(var.CustomActionInstaller.TargetDir)CustomActionInstaller.CA.dll" />
<CustomAction Id="GetAllPath" BinaryKey="PathCustomAction" DllEntry="GetAllPath" Return="check" Execute="immediate"/>
<InstallUISequence>
<Custom Action="GetAllPath" Before="AppSearch" />
</InstallUISequence>
编辑:
我读到,在自定义操作中可能无法读取这些字符串。我可以将它们分配给属性。但是,如何在更改属性后覆盖字符串?
<Property Id="StartPathCCSProp" Value="!(loc.StartPathCCS)"></Property>
session["StartPathCCSProp"] = "...";