如何在Visual Studio Code中更改默认的构建输出目录 [英] How can I change the default build output directory in Visual Studio Code

查看:86
本文介绍了如何在Visual Studio Code中更改默认的构建输出目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Visual Studio Code的新手.我想在csproj中定义输出目录.我不知道在Visual Studio Code中要在哪里更改目标文件夹以找到生成的dll文件.

I'm new to Visual Studio Code. I want to define the output directory in my csproj. I don't know where to change in Visual Studio Code the destination folder to locate the dll files generated.

推荐答案

VSCode使用dotnet CLI,尤其是用于构建

VSCode uses dotnet CLI and particularly for building the dotnet build command. Among others, it has the following option

-o|--output <OUTPUT_DIRECTORY>
Directory in which to place the built binaries.


假设您的构建任务是在 .vscode/tasks.json 文件中定义的:

{
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "build",
            "command": "dotnet build",
            ...
        }
    ]
}

您可以在所需的路径中添加 -o arg.例如,更改为:

You may add -o arg with the desired path. For example, change to:

...
"command": "dotnet build -o ${workspaceRoot}/bin/another_Debug/",
...

其中 $ {workspaceFolder} 是VSCode 预定义的变量:

where ${workspaceFolder} is one of VSCode predefined variables:

$ {workspaceFolder}包含task.json文件的工作区文件夹的路径

${workspaceFolder} the path of the workspace folder that contains the tasks.json file

这篇关于如何在Visual Studio Code中更改默认的构建输出目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆