WIxsharp 在控制台中调试自定义操作

WIxsharp debug custom action in console(WIxsharp 在控制台中调试自定义操作)
本文介绍了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 在控制台中调试自定义操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)