I'm trying to set the -checked compiler option for a C# library project written over .NET Core, using VS Code as the IDE. How can I do this?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
When you open your project/solution with VS Code, it will create a directory called .vscode
, within it there will be a tasks.json
file
(this directory and file are created the first time that you hit F5 within VS Code)
Taking a look at this file, you'll that it takes a format similar to the following:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/project.csproj"
],
"problemMatcher": "$tsc"
}
]
}
(you may have more task entries)
You can add individual arguments to each task by adding a string to its args
array. In the above example I am calling the CLI command dotnet
and passing it the arguments build
and ${workspaceFolder}/project.csproj