VS Code 的launch.json和tasks.json 簡介,移除某個 `nuget` 包
##launch.json 簡介
1.環境 Windows,.NET Core 2.0,VS Code
dotnet> dotnet new console -o myApp
2.launch.json
配置檔案
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/myApp/bin/Debug/netcoreapp2.0/myApp.dll",
"args": [],
"cwd": "${workspaceFolder}/myApp",
// For more information about the ‘console‘ field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
,]
}
在launch.json
中
name
:配置名稱,在啟動配置下拉選單中顯示type
:配置型別request
:請求配置型別(一般為launch
或attach
)執行或附加preLaunchTask
:除錯會話前要執行的任務program
:程式Build
以後生成的dll
,預設是${workspaceFolder}/bin/Debug/(target-framework)/(project-name.dll)
workspaceFolder
:正在除錯的程式的工作目錄的路徑。預設為當前工作區(即使用Code
命令進入的目錄)target-framework
:框架args
:傳遞給程式的命令列引數cwd
:專案目錄console
:啟動除錯目標的位置stopAtEntry
:偵錯程式是否在目標的入口點停止,預設為false
internalConsoleOptions
:內部除錯控制檯的控制行為processId
:要附加到的程式id
。使用 “$ {command:pickProcess}
”
以獲取要附加到的正在執行的程式的列表。如果使用 “processId
”, 則不應使用 “processName
”。
注:在.NET Core 1.0
版本中
externalConsole
:Console
單獨啟動配置,開發console
時,如果需要輸入後除錯,將值設定為true
,將console
單獨啟動即可。
##tasks.json 簡介
1.執行命令:dotnet> dotnet new console -o myApp
2.tasks.json
檔案配置:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/myApp/myApp.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
tasks
:任務配置,通常是外部任務執行程式中已定義任務的擴充label
:任務的使用者介面標籤command
:要執行的命令。可以是外部程式或shell
命令(這裡一般表示使用dotnet
命令)type
:定義任務是被作為程式執行還是在shell
中作為命令執行args
:在呼叫此任務時傳遞給命令的引數(在.NET Core 1.0
中,"build
"在tasks
下taskname
標籤下)problemMatcher
:要使用的問題匹配程式。可以是字串或問題匹配程式定義,或字串和問題匹配程式陣列結合起來就是告訴powershell
執行
dotnet build {workspaceFolder}/myApp/myApp.csproj
##.NET Core
環境下使用命令列移除某個 nuget
包的具體方法
.NET Core
使用Nuget
包一般是先寫入csproj
檔案,然後下載儲存在\bin\Debug\netcoreapp2.0\publish\
下,所以可以採用如下方案進行刪除操作(其中netcoreapp2.0
是.NET Core
版本)。
第一種:修改配置和手動刪除檔案(不建議)
對於任何系統環境下都有效,直接修改csproj
檔案,nuget
包都包含在這個檔案下,修改後刪除你本地相同包名稱的檔案就行。
例如:刪除<PackageReference Include="Microsoft.AspNetCore.Session" Version="2.0.1" />
這行程式碼後(本行刪除後重新開啟專案,該nuget
包就被專案移除了),刪除 專案位置\bin\Debug\netcoreapp2.0\publish\Microsoft.AspNetCore.Session.dll
檔案就可以刪除該nuget包。
第二種:採用 Nuget
包管理命令(建議)
使用如下命令進行Nuget
包的刪除操作(對於所有安裝.NET Core
的系統都通用):
以刪除Microsoft.AspNetCore.Session
包為例:在專案目錄下使用如下命令即可,由於沒有安裝Linux
下的.NET Co
re
所以在Windows
下做演示。
F:\文件\Visual Studio Code\MyWeb\MyWeb.Web>dotnet remove MyWeb.Web.csproj package Microsoft.AspNetCore.Session
info : Removing PackageReference for package 'Microsoft.AspNetCore.Session' from project 'MyWeb.Web.csproj'.
大家可以參考官網說明:https://docs.microsoft.com/zh-cn/nuget/tools/dotnet-commands
其中移除命令的具體使用如下:
使用情況: dotnet remove <PROJECT> package [選項] <PACKAGE_NAME>
引數:
<PROJECT>
要操作的專案檔案。如果未指定檔案,則命令會在當前目錄下搜尋一個檔案。
<PACKAGE_NAME>
要刪除的包引用。
相關文章
- .net 知新:【4】NuGet簡介和使用
- 簡介的jQuery移入移除jQuery
- 10分鐘學會VS NuGet包私有化部署
- js移除和新增class樣式類簡單介紹JS
- vs2010 利用NuGet來安裝EFCodeFirst
- 釋出nuget包的正確姿勢---cicd自動打包釋出nuget包
- nuget 包是如何還原的
- 建立NuGet本地包源
- VS code 簡單配置
- vscode外掛使用包VSCode
- 如何從零開發一個NuGet軟體包?
- 使用 nuget server 的 API 來實現搜尋安裝 nuget 包ServerAPI
- CVS 簡介(轉)
- vscode和visualstudio區別 vscode和visualstudio哪個好VSCode
- 建立併發布自己的nuget包
- VS上使用Nuget部分分析
- 關於 vs code 中文語言包的 bug
- VsCode簡單配置VSCode
- c語言初學者用vs還是vscode vs和vscode哪個適合初學者C語言VSCode
- HDL Code 簡介
- CodePen簡介
- CODEVS 3269 混合揹包dev
- VSCode軟體介紹VSCode
- Golang : pflag 包簡介Golang
- Golang : cobra 包簡介Golang
- DevSecOps 簡介(一)dev
- DevSecOps簡介(二)dev
- CVS使用簡介(轉)
- 簡單介紹vscode除錯container中的程式的方法步驟VSCode除錯AI
- 禁用某個keycode操作
- NuGet是什麼?為什麼.NET專案中會有NuGet?如何使用NuGet程式包?
- LeetCode:每日一題:27. 移除元素 ——————簡單LeetCode每日一題
- VSCode一個簡單的vue移動端適配方案VSCodeVue
- 誰有打包好的vscode中go需要的14個包,請共享下?VSCodeGo
- VS 2008 和 .NET 3.5 Beta 2 簡介
- nuget包管理:製作、釋出包到nuget伺服器、從nuget伺服器刪除包伺服器
- 釋出Nuget包時遇到都意外
- 釋出 Rafy .NET Standard 版本 Nuget 包