博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How to debug .NET Core RC2 app with Visual Studio Code on Windows?
阅读量:5770 次
发布时间:2019-06-18

本文共 2608 字,大约阅读时间需要 8 分钟。

Simone Chiaretta ()


So, you , you followed and you got your “Hello World!” printed on your command prompt just by using the CLI. Then you went the next step and you tried to use and the to edit the application outside of Visual Studio. And finally you want to try and debug and set a breakpoint inside the application, but you encountered some problems and nothing worked. Here is how to make it work.

Specify the launch configuration

Visual Studio Code needs to know how to launch your application, and this is specified in alaunch.json file inside the .vscode folder. From the debug window, click the “gear” icon and Code will create it for you: just choose the right environment “.NET Core”.

Then you must specify the path to your executable in the program property. In the standard hwapp sample app, replace

1: "program": "${workspaceRoot}/bin/Debug/
/
",

with

1: "program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/hwapp.dll",

There is much more you can specify in the launch.json file. To see all the options have a look at the official doc: .

Specify the task runner

If you try to debug now you’ll have another warning: “No task runner configured”.This is because for launching, VS Code has to build the project, and this is done via a task. But no worries, just click the “Configure Task Runner” button in the info box, choose which task runner you want to use, in this case “.NET Core”, and the tasks.json file will be created for you. More info on task runners in VS Code can be found on the offical documentation: .

Running and debugging

Now you can click the “Start Debugging” button or F5 and the application runs. Cool… Now you set a breakpoint and the executions stops where you set it, doesn’t it? Well… if you are on Mac or Linux it does. But it doesn’t stop if you are on Windows and the Debug Console says something like:

1: WARNING: Could not load symbols for 'hwapp.dll'.
2: '...\hwapp\bin\Debug\netcoreapp1.0\hwapp.pdb' is a Windows PDB.
3: These are not supported by the cross-platform .NET Core debugger.

Introducing Portable PDBs

In order to be able to debug cross-platform, , and the newly introduced .NET Core debugger for Visual Studio Code only supports this format. Unfortunately by default, on Windows, the .NET Core build generates standard “Windows PDBs”, which are not supported. But the fix is easy, you just have to tell the compiler to generate portable PDBs.

This is done by specifying the debugType to be portable.

1: {
2:   "buildOptions": {
3:     "debugType": "portable"
4:   },
5:   ...
6: }

And voila! Breakpoints are hit!

转载地址:http://tdiux.baihongyu.com/

你可能感兴趣的文章
JS重载
查看>>
python2和python3同安装在Windows上,切换问题
查看>>
php加速工具xcache的安装与使用(基于LNMP环境)
查看>>
android超链接
查看>>
redhat tomcat
查看>>
统计数据库大小
查看>>
IO流的学习--文件夹下文件的复制
查看>>
第十六章:脚本化HTTP
查看>>
EXCEL表中如何让数值变成万元或亿元
查看>>
Cisco PIX防火墙的安装流程
查看>>
配置系列:ssm中applicationContext-mybatis.xml的简单配置
查看>>
mysql或者mariadb备份脚本
查看>>
extundelete恢复文件
查看>>
电池温度检测原理和示例代码
查看>>
Linux服务器性能评估与优化、监控利器---dstat应用
查看>>
hdu 2842 Chinese Rings 矩阵快速幂
查看>>
Powershell进阶学习(4) Powershell强大的利器“管道”
查看>>
关于GNU GPL
查看>>
request.getServletPath()和request.getPathInfo()用法
查看>>
nginx在响应request header时候带下划线的需要开启的选项
查看>>