WIxsharp 在控制台中调试自定义操作 [英] WIxsharp debug custom action in console

查看:20
本文介绍了WIxsharp 在控制台中调试自定义操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个编译为 .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 文件夹,然后运行了构建,现在它似乎可以工作了.System.Diagnostics.Debugger.Launch() 确实可以正常工作,它需要包含在 #if DEBUG 中,正如@Stein Åsmul 所述.一旦内置 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆