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


- 输入按键事件处理程序 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- C# 中多线程网络服务器的模式 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01