MAUI Windows 在发布时打开控制台窗口

huangapple go评论121阅读模式
英文:

MAUI Windows open console windows on release

问题

我正在使用MAUI Blazor开发应用程序。在调试版本中,我可以使用快捷键(CTRL+SHIFT+C)打开Chrome控制台窗口,但是在发布版本中无法。我遇到了一个问题,应用在发布版本中崩溃,但是无法找到错误在哪。我该如何打开Chrome控制台窗口?

英文:

I am using MAUI blazor for developing an app. On debug build I can open chrome console window with shortcuts (CTRL+SHIFT+C), however on release I can't.

I have an issue that app crashes in release build and cannot find what the error is. How could I open chrome console window?

答案1

得分: 1

你可以在你的项目中打开MauiProgram.cs文件,其中的代码如下:

builder.Services.AddBlazorWebViewDeveloperTools();
builder.Logging.AddDebug();

这是为了确保Blazor混合项目配置为支持浏览器开发者工具。你只需要将#if条件移除,像这样,它就会在发布模式下启用:

builder.Services.AddBlazorWebViewDeveloperTools();
builder.Logging.AddDebug();
英文:

You can open the MauiProgram.cs file in your project, which has code like this:

#if DEBUG
     builder.Services.AddBlazorWebViewDeveloperTools();
     builder. Logging. AddDebug();
#endif

This is to ensure that the Blazor Hybrid project is configured to support browser developer tools .You just need to remove the #if condition like this and it will be turned on in release mode too.

         builder.Services.AddBlazorWebViewDeveloperTools();
         builder. Logging. AddDebug();

huangapple
  • 本文由 发表于 2023年3月9日 19:48:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/75684181.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定