简体   繁体   中英

Visual Studio Code C# Project has incorrect assembly (program) path (HPD)

When I create a C# project within Visual Studio Code v1.16.1, I execute the following commands from a command prompt:

dotnet new console -o TestConsoleApp
cd TestConsoleApp
code .

Visual Studio then launches with a sample "Hello World" console application.

I have the C# extension by OmniSharp installed:

在此处输入图片说明

But when I attempt to debug the application (F5) I get the following:

在此处输入图片说明 which reads:

Error launch: program 'c:\\Dev\\VSCode\\TestConsoleApp\\bin\\Debug\\netcoreapp2.0\\TestConsoleApp.dll' does not exist.

The reason for this is because the launch.json specifies the program as

"program": "${workspaceRoot}/bin/Debug/netcoreapp2.0/TestConsoleApp.dll",

But the application, when it loads for the first time creates the path as:

~\bin\HPD\Debug\netcoreapp2.0

And stores all the appropriate assembly information at that location.

Why is HPD appearing in the actual program path? It would appear that it is extraneous, and I used nothing but the defaults when installing. I can't figure out why it is being added to the path.

If I adjust the launch.json, then everything works fine. It isn't clear why the "HPD" is being added when the project is created.

This can happen when an environment variable overrides values in the build process. The variable that drives this is Configuration .

Check your system and user environment variables if any Configuration variable is set. The sample problem applies to Platform variables (usually set on some HP laptops).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM