为什么我应该在 VsCode 中清理和构建我的 C# 控制台项目? [已关闭]

问题描述 投票:0回答:1

我的迁移层有一个 dotnet 7.0 c# 控制台项目,问题是我应该在对其进行一些更改时清理并构建我的项目。 如果我不这样做,我的更改就不会执行。

我在 Visual Studio 中尝试,它工作正常

c# visual-studio-code console-application
1个回答
1
投票

在我的 launch.jason 文件和控制台项目配置中,我使用了

 "preLaunchTask": "build"
并且我的 task.json 文件中有这个标签用于“build”

{
        "label": "build",
        "command": "dotnet",
        "type": "process",
        "args": [
            "build",
            "${workspaceFolder}/Cooking.RestApi/Cooking.RestApi.csproj",
            "/property:GenerateFullPaths=true",
            "/consoleloggerparameters:NoSummary"
        ],
        "problemMatcher": "$msCompile"
    }

如您所见,这是我的 RestApi 层,我为我的控制台应用程序创建了如下所示的新任务

{
        "label": "build-migration",
        "command": "dotnet",
        "type": "process",
        "args": [
            "build",
            "${workspaceFolder}/Cooking.Migrations/Cooking.Migrations.csproj",
            "/property:GenerateFullPaths=true",
            "/consoleloggerparameters:NoSummary"
        ],
        "problemMatcher": "$msCompile"
    }

最后我把它放在我的 Lunch.jason 文件中,如下所示:

{
        "name": "Migrations",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build-migration",
        "program": "${workspaceFolder}/Cooking.Migrations/bin/Debug/net7.0/Cooking.Migrations.dll",
        "args": [],
        "cwd": "${workspaceFolder}/Cooking.Migrations",
        "stopAtEntry": false,
        "console": "internalConsole"
    }
© www.soinside.com 2019 - 2024. All rights reserved.