[英]How can I attach to a specific process in Visual Studio Code
When I debug my .net core project in VSC I'm asked for a process Id to attach to.当我在 VSC 中调试我的 .net 核心项目时,我被要求提供一个要附加到的进程 ID。 This shows a long list of running processes where I either type or scroll to find a specific process.
这显示了一长串正在运行的进程,我可以在其中键入或滚动以查找特定进程。 How can I attach to a specific same process each time I want to debug?
每次我想调试时如何附加到特定的相同进程?
In visual studio code your debug options can be changed in the launch.json
file.在 Visual Studio 代码中,您可以在
launch.json
文件中更改调试选项。 You can get to this file quickly through debug.您可以通过调试快速访问该文件。 Simply click the cog icon to open the json file.
只需单击齿轮图标即可打开 json 文件。
Here you will see configurations for your setup.在这里,您将看到您的设置的配置。
"configurations": [
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId":"${command:pickProcess}"
}
]
name
refers to the option inside the debug dropdownlist. name
是指调试下拉列表中的选项。
Find the configuration using processId
and change this to processName
使用
processId
查找配置并将其更改为processName
processName
is the process name to attach to. processName
是要附加到的进程名称。 If this is used, processId
should not be used.如果使用它,
processId
不应使用processId
。
The process name will be the .exe of the process id you'd normally be selecting.进程名称将是您通常选择的进程 ID 的 .exe。 Once this change is made next time you debug on the option you will automatically attach to your specified process if it is running.
下次调试该选项时进行此更改后,您将自动附加到指定的进程(如果它正在运行)。
"configurations": [
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processName":"someProcess.exe"
}
]
An alternative is:另一种选择是:
dotnet watch core
dotnet watch core
运行您的应用程序.NET Core Attach
.NET Core Attach
上运行首次亮相YourProjectName.dll
YourProjectName.dll
.dll 文件I hope it helped.我希望它有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.