WIxsharp调试控制台中的自定义操作 [英] WIxsharp debug custom action in console
问题描述
我有一个可编译为.dll的自定义操作项目,我希望能够逐步执行我的自定义操作,我知道可以将程序包更改为wixsharp.bin,但这并不实用.无论如何,我仍然尝试了这种方法,但是没有达到断点.
I have a custom action project which compiles to a .dll, I want to be able to step through my custom actions, i know the package can be changed to wixsharp.bin but this dosn't seen very practical. Regardless, I still tried this method but it didn't hit my breakpoints.
Wix使用:System.Diagnostics.Debugger.Launch();
在调试中启动操作,这似乎不适用于wixsharp,但是预期的结果是我正在尝试实现的目标.
Wix uses: System.Diagnostics.Debugger.Launch();
which launches the action in debug, this dosn't seem to work for wixsharp but it's expected result is what i am trying to achieve.
我已经看到debug.assert可用于调试,并且还看到了对#if DEBUG #endif
如何正确调试的参考?
I have seen that debug.assert can be used for debugging and i have also seen references to #if DEBUG #endif
How do i debug correctly?
[CustomAction]
public static ActionResult CustomAction(Session session)
{
Debug.Assert();
MessageBox.Show("Hello World!" + session[IISSessions.AppPoolName], "External Managed CA");
return ActionResult.Success;
}
推荐答案
不太确定是什么原因导致的,我删除了bin文件夹,然后运行了一个构建,现在看来它可以正常工作.如@SteinÅsmul所述,System.Diagnostics.Debugger.Launch()
确实可以正常工作,它必须包含在#if DEBUG
中.内置DEBUG后,运行输出的.msi,当您在安装过程中点击自定义操作时,系统将提示您打开Visual Studio实例.
Not quite sure what was causing the problem, I deleted my bin folder and then ran a build and it now seems to be working. System.Diagnostics.Debugger.Launch()
does work correctly it needs to be contained within an #if DEBUG
as @Stein Åsmul stated. Once built in DEBUG run the outputed .msi, you will be prompted to open an instance of visual studio when you hit your custom action during install.
[CustomAction]
public static ActionResult CustomAction(Session session)
{
#if DEBUG
System.Diagnostics.Debugger.Launch();
#endif
MessageBox.Show("Hello World!" + session[IISSessions.AppPoolName], "External Managed CA");
return ActionResult.Success;
}
这篇关于WIxsharp调试控制台中的自定义操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!