最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

.net - VSCode doesn't find sln file when debugging - Stack Overflow

programmeradmin1浏览0评论

I am trying to run a console app in debug mode using VSCode.

My .sln file is in a "src" folder (see ).

I have multiple projects in the solution: a web API, a class library, and a console exe. I want to launch the console in debug mode.

My launch.json file is as follows:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "ArcadeManager Console",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/src/ArcadeManager.Console/bin/Debug/net8.0/ArcadeManager.Console.dll",
            "args": [],
            "cwd": "${workspaceFolder}/src/ArcadeManager.Console",
            "stopAtEntry": false,
            "console": "internalConsole"
        }
    ]
}

When I try to run the configuration, I get the following:

Executing task: C:\Program Files\dotnet\dotnet.exe build C:\Dev\arcademanager/ArcadeManager.sln /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary;ForceNoAlign

MSBUILD : error MSB1009: Le fichier projet n'existe pas. Commutateur : C:\Dev\arcade-manager/ArcadeManager.sln

As you can see it searches for the proper file, but not in the proper folder?

How do I specify it the proper path to the sln file?

Thanks!

I am trying to run a console app in debug mode using VSCode.

My .sln file is in a "src" folder (see https://github/cosmo0/arcade-manager).

I have multiple projects in the solution: a web API, a class library, and a console exe. I want to launch the console in debug mode.

My launch.json file is as follows:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "ArcadeManager Console",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/src/ArcadeManager.Console/bin/Debug/net8.0/ArcadeManager.Console.dll",
            "args": [],
            "cwd": "${workspaceFolder}/src/ArcadeManager.Console",
            "stopAtEntry": false,
            "console": "internalConsole"
        }
    ]
}

When I try to run the configuration, I get the following:

Executing task: C:\Program Files\dotnet\dotnet.exe build C:\Dev\arcademanager/ArcadeManager.sln /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary;ForceNoAlign

MSBUILD : error MSB1009: Le fichier projet n'existe pas. Commutateur : C:\Dev\arcade-manager/ArcadeManager.sln

As you can see it searches for the proper file, but not in the proper folder?

How do I specify it the proper path to the sln file?

Thanks!

Share edited Mar 4 at 9:20 thomasb asked Mar 3 at 21:14 thomasbthomasb 6,05510 gold badges60 silver badges94 bronze badges 2
  • It looks like Windows. Then it should be ArcadeManager.Console.dll. Also, there is another launch configuration that requres a *proj file instead, then the launch will perform dotnet run instead of starting the application. Basically, this kind of configuration can work ignoring the solution. I have a big code repository and several articles (series incomplete) in solution structure, can point you there. You need to know quite a bit on .NET MSBuild and configurations. – Sergey A Kryukov Commented Mar 3 at 23:33
  • It's already pointing to the DLL. If you have a working example I'll take it. – thomasb Commented Mar 4 at 9:19
Add a comment  | 

1 Answer 1

Reset to default 1

Ok so I found the culprit.

In the files explorer (not the .Net solution explorer, not the debug panel) there is a file .vscode\tasks.json which is documented here: https://code.visualstudio/docs/editor/tasks

It turns out this is what launch.json is referring to in the preLaunchTask property: the name of an entry in the tasks list.

Here the build task was in fact defined with the wrong path to the sln file.

发布评论

评论列表(0)

  1. 暂无评论