问题描述
我是新手,正在尝试学习。 目的是获取当前的安装程序名称并将其存储在文本文件中。
这就是我所做的。
Product.wxs
<CustomAction Id="SetCustomActionDataValue" Return="check"
Property="MyCustomAction2" Value="INSTALLLOCATION=[INSTALLLOCATION];
AnotherValue='Just a value'" />
<Binary Id='MyCustomAction1' SourceFile="..\MyCustomAction1\bin\Release\MyCustomAction1.CA.dll" />
<InstallExecuteSequence>
<Custom Action="SetCustomActionDataValue"
Before="MyCustomAction2">NOT Installed</Custom>
<Custom Action="MyCustomAction2" After="InstallInitialize" />
</InstallExecuteSequence>
自定义操作类
im首先尝试在消息框中显示它。我使用msiexc log.txt检查数据是否在那里显示。
{
public class CustomActions
{
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
session.Message(InstallMessage.Warning,new Record(new string[]
{
string.Format("INSTALLLOCATION{0}",session.CustomActionData["INSTALLLOCATION"])
}));
MessageBox.Show(string.Format("Another Value{0}",session.CustomActionData["AnotherValue"]));
session.Message(InstallMessage.Warning,new Record(new string[]
{
string.Format("Another Value{0}",session.CustomActionData["AnotherValue"])
}));
session.Log("Begin CustomAction1");
File.Create(@"D:\file.txt");
return ActionResult.Success;
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)