VS Code 1.19.3 debugging .net core 2 and always meet “Only 64-bit processes can be debugged”

纵然是瞬间 提交于 2019-12-07 13:42:02

问题


I've installed both x86 & x64 sdk of .net core 2.0 on my laptop (win 7 sp1 x64). I don't know why the vs code (1.19.3 & x64 & official c# extension) always choose the x86 runtime auto to build my console and always meet error and popup message: "Only 64-bit processes can be debugged.".

Then I tried:

  1. I read the question of .NET Core debugging with VS Code - “Only 64-bit processes can be debugged”. And seems not working for me at all followed the answer to change the json file and csproj file.

  2. I've tried simple console project by running "C:\Program Files\dotnet\dotnet" new console. The error message is there while debugging.

  3. Also, I've tried force to point to x64 runtime to build by modifying the file .vscode\tasks.json:

    {

    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "build",
            "command": "dotnet", --> change to "C:\\Program Files\\dotnet\\dotnet.exe"
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/VSDebugCoreTest.csproj"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
    

    }

The error message is still there "Only 64-bit processes can be debugged.".

I've x64 vscode, I've x64 sdk & runtime, I've create & compile with x64 version of sdk, and from the internal terminal show me the compiled succeeded.

Anyone know why and how to bypass this error and able to debugging? (please do NOT tell me to install VS, it's huge for me.)


回答1:


I faced similar issue trying to debug azure function in VSCode. The problem was in azure-functions-core-tools installed through chocolatey. Currently it is installing x86 version of tools. Steps I made to solve the problem:

  1. run choco uninstall azure-functions-core-tools
  2. download nupkg file from here
  3. edit tools\chocolateyinstall.ps1 script (change x86 to x64 in a url)
  4. run choco install azure-functions-core-tools -source . --ignore-checksums in a folder where edited nupkg file is
  5. have fun debugging your functions in VSCode



回答2:


After about one day's investigation, I got the real reason and the solution. Thanks for anyone who read my question. (self ask self answer)

Reason:

  1. I installed x86 .net core sdk beside x64 one. Then system environment variable "path" contains both C:\Program Files (x86)\dotnet and C:\Program Files\dotnet;
  2. The debugger of .net core in visual studio code now is only support x64 version. Even if I force use x64 to build, the debugger recognize dotnet.exe in path and implicitly use x86 dotnet.exe to run a x64 program;

That's why I always got the error message: "Only 64-bit processes can be debugged."

My solution is quite easy:

  1. remove C:\Program Files (x86)\dotnet from path;

or

  1. uninstall x86 .net sdk thoroughly.



回答3:


  1. Go to Environment variables
  2. Select Edit for Path system variable
  3. Move C:\Program Files\dotnet\ entry up over C:\Program Files (x86)\dotnet\
  4. Click OK
  5. Close and start VS Code again.


来源:https://stackoverflow.com/questions/48537587/vs-code-1-19-3-debugging-net-core-2-and-always-meet-only-64-bit-processes-can

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!