.NET Core debugging with VS Code - "Only 64-bit processes can be debugged"
Solution 1
Version 1.9.0 of the ms-vscode.csharp extension added desktop CLR support.
Modify your launch.json file:
"type" : "clr",
"program" : "path to x64 version of the executable.exe"
To target x64, modify your .csproj file like so:
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>
An example program path after specifying the runtime id:
"program" : ${workspaceRoot}/src/bin/Debug/net461/win7-x64/example.exe
Solution 2
Below worked for me:
- Go to Environment variables
- Select Edit for Path system variable
- Move C:\Program Files\dotnet\ entry up over C:\Program Files (x86)\dotnet\
- Click OK
- Close and start VS Code again.
Solution 3
after losing a day "what to do...'
- here were the steps I use the UPDATE to move to ver 3 because was giving me a "Old version is in use'
from ver 2 to ver 3
you need to run CMD as Administrator you can skip to step 3 if you do not have install it
choco upgrade azure-functions-core-tools-3
- I uninstall it
choco uninstall azure-functions-core-tools-3
then
THE MOMENT OF TRUTH To install the 64-bit version, which allows you to debug, you can use the command
choco install azure-functions-core-tools-3 --params="'/x64:true'"
BAM worked
The solution is in the first comment
https://chocolatey.org/packages/azure-functions-core-tools-3#install
thanks Tyler Doerksen life saver!!!!
Solution 4
I had to reinstall dependencies directly. If you used a package manager like chocolatey to install dependencies like 'azure-functions-core-tools' or 'dotnet core', you'll have to remove those from chocolatey and install directly.
Related videos on Youtube
Joe
I'm a Software Engineer at BAE Systems applied intelligence, and CTO of a start-up Chiron Tutors. I work with React, Angular, Typescript and Node and have extensive experience in C# and WPF.
Updated on June 04, 2022Comments
-
Joe almost 2 years
I don't have VS 2017, and I'll be building a web front-end in VS Code anyway so I want to use VS Code.
Until .NET Standard 2.0 comes out, our libraries are also in 4.6.1, so I'm targetting net461 in my .NET Core csproj:
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net461</TargetFramework> </PropertyGroup> <ItemGroup> <Folder Include="wwwroot\" /> </ItemGroup> <ItemGroup> <PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" /> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" /> </ItemGroup> </Project>
The project is the simplest
dotnet new webapi
starter app. I can build and run withdotnet build
anddotnet run
. I've also got the latest ms-vscode.csharp extension 1.8.1.However, when I try attaching or debugging this application with VS Code I get the error
Failed to attach to process: Only 64-bit processes can be debugged
Even running from console, then attaching with the very simple configuration:
{ "name": ".NET Core Attach", "type": "coreclr", "request": "attach", "processId": "${command:pickProcess}" }
And selecting the process fails with this error. I've tried building the exe targeting x64 with:
<PropertyGroup> <TargetFramework>net461</TargetFramework> <Platform>x64</Platform> </PropertyGroup>
But it produces the same error. Anyone know a fix? It seems to be because I'm targetting net461, does debugging .Net Core not support targeting other frameworks?
-
Tseng about 7 yearsTry adding
<RuntimeIdentifier>**YOUR-OS-ID-HERE**-x64</RuntimeIdentifier>
. See docs.microsoft.com/en-us/dotnet/articles/core/rid-catalog for a list of OS specific identifiers
-
-
Joe almost 7 yearsThanks, I had missed the "win7-x64" out of the program path and it was pointing to the older version in net461. Note, for anyone else reading this, that type "clr" had to be "coreclr".
-
DreamFlasher over 3 yearsThank you so much for finding the solution!
-
Lis over 2 yearsThx, it saved me a lot of time