action1如何从 C# 自定义操作中设置 MSI 属性,到目前为止我已经有了这个,但如何获取句柄?
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
static extern int MsiSetProperty(IntPtr hInstall, string szName, string szValue);
public void SetProperty(string propertyName, string propertyValue)
{
MsiSetProperty(handle, propertyName, propertyValue);
}
我使用以下行从 WiX 呼叫 CA
<CustomAction Id="CA1" BinaryKey="ca1.dll" DllEntry="action1" />
动作1看起来像这样
public class CustomActions
{
[CustomAction]
public static ActionResult action1(Session session)
{
session.Log("Begin action1");
SetProperty("xyz", "123");
}
}
您应该能够通过执行以下操作来设置属性:
public class CustomActions
{
[CustomAction]
public static ActionResult action1(Session session)
{
string xyzProperty = "XYZ";
session[xyzProperty] = "ABC";
}
}
请参阅克里斯托弗·佩因特的帖子:
http://blog.deploymentengineering.com/2008/05/deployment-tools-foundation-dtf-custom.html http://blog.deploymentengineering.com/2008/05/deployment-tools-foundation-dtf-custom.html
我相信他很快就会对此发表评论。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)