如何调试自定义引导程序应用程序? [英] How to debug custom bootstrap application?

查看:32
本文介绍了如何调试自定义引导程序应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Burn for MSIs 包.我正在使用 Votive (Visual Studio) &我自己的自定义 BA 而不是 WiXBA.我尝试使用 Debugger.Launch() 调试自定义 BA.但是当我开始调试时,会出现错误消息.

I am using Burn for MSIs package. I am using Votive (Visual Studio) & my own custom BA instead of WiXBA. I tried to debug custom BA using Debugger.Launch(). But when I start debugging, error messages occur.

没有为任何调用堆栈帧加载符号.源代码无法显示

No symbols are loaded for any call stack frame. The source code cannot be displayed

我意识到 package.exe 链接了位于 C:\Documents and Settings\user\Local Settings\Temp\{GUID}\ 的 CustomBA dll.{GUID} 总是会改变.因此,每当我运行 package.exe 时,总是会更改目录.

I realized that package.exe links CustomBA dll which located at C:\Documents and Settings\user\Local Settings\Temp\{GUID}\. {GUID} is always changed. So, whenever I run package.exe, always directory is changed.

我认为这就是发生错误的原因.

I think that is the reason to occur errors.

在 Visual Studio 中,当我使用位于绝对路径 (.../Debug/bin/CustomBA.dll) 的 CustomBA dll 启动 package.exe 时.但是在执行 package.exe 后,它会链接到 Local Settings\Temp\{GUID} 目录.因此,当我们开始调试并附加到 CustomBA dll 时,CustomBA dll 的目录会动态更改,并且会发生 No symbols are loaded 错误.

In Visual Studio, When I started package.exe with CustomBA dll which located at absolute path (.../Debug/bin/CustomBA.dll). But after execute the package.exe, it links to Local Settings\Temp\{GUID} directory. So, when we start debugging and attached to CustomBA dll, CustomBA dll's directory is dynamically changed and No symbols are loaded error occurs.

  • 为什么 package.exe 链接位于 C:\Documents 和Settings\user\Local Settings\Temp\{GUID}\?我们可以选择路径吗用于静态 dll?
  • 如果不能静态选择dll路径,如何调试CustomBA 的函数?
  • Why package.exe links dll which located at C:\Documents and Settings\user\Local Settings\Temp\{GUID}\? Can we choose the path for dll statically?
  • If we can't choose the dll path statically, how can I use debugging functions for CustomBA?

推荐答案

要调试 Bootstrapper 应用程序,您需要 Bundle .wixproj 和 BA .csproj(或者 .vcxproj,如果您正在执行本机 .dll)在同一个解决方案中,Bundle 项目应该依赖于 BA 项目,因此重建工作正常.以下步骤应该允许您进入您的代码.

To debug a Bootstrapper Application, you'll want both your Bundle .wixproj and BA .csproj (or .vcxproj if you're doing a native .dll) in the same solution and the Bundle project should be dependent on the BA project so rebuilds work correctly. The following steps should allow you to step into your code.

注意:确保您运行提升的 Visual Studio.如果您禁用了 UAC,请重新启用它.如果 Visual Studio 以提升的权限运行,这些步骤将无法正常工作.

Note: Ensure you are not running Visual Studio elevated. If you have UAC disabled, re-enable it. These steps will not work correctly if Visual Studio is running elevated.

  1. 重建项目.这可确保您创建了一个 Bundle,其中包含更新的 BA.dll.
  2. 在解决方案资源管理器中右键单击 BA .csproj,然后选择 Set as StartUp Project.BA .csproj 应该是粗体.
  3. 右键单击 BA .csproj 并选择 Properties.
  4. 在 BA .csproj 的 Properties 上,选择 Debug 选项卡.
  5. Debug 选项卡中,选择标记为 Start external program
  6. 的单选按钮
  7. 浏览到构建 Bundle 的路径.
  1. Rebuild the project. This ensures you have a Bundle created with an updated BA.dll inside it.
  2. Right click on the BA .csproj in Solution explorer and select Set as StartUp Project. The BA .csproj should be bold.
  3. Right click on the BA .csproj and choose Properties.
  4. On the Properties for the BA .csproj select the Debug tab.
  5. In the Debug tab, choose the radio button labeled Start external program
  6. Browse to the path where your Bundle is built.

现在,您可以按 F5 并开始调试.请记住,无论何时更改 BA .csproj,您还需要确保重新构建 Bundle .wixproj.否则,Bundle 将使用您的旧 BA 启动,并且调试器会发现新构建的 BA 的 .pdbs 不匹配.

Now, you can press F5 and start debugging. Remember that any time you change the BA .csproj, you also need to ensure the Bundle .wixproj is rebuilt. Otherwise, the Bundle will launch with your old BA in it and the debugger will find the newly built BA's .pdbs don't match.

额外功劳:如果您在调试器设置中禁用 Just My Code 并下载 pdbs.zip 和 sources.zip 以匹配您的 WiX 安装版本,您实际上可以逐步完成Burn 代码以及您的 BA 以了解所有内容如何协同工作.

Extra credit: if you disable Just My Code in the debugger settings and download the pdbs.zip and sources.zip for the matching build of your WiX install, you can actually step through the Burn code as well as your BA to see how everything works together.

这篇关于如何调试自定义引导程序应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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