【发布时间】:2021-04-04 02:25:04
【问题描述】:
我正在尝试 - 为了学习 - 为 VSCode 编写 tasks.json 和 launch.json 来构建这个项目:ExportableDataGrid
有两个 .csproj - 一个构建一个“库”,另一个构建一个依赖于库的“WinExe”。
构建成功,但调试器没有启动 .exe 并出现此错误:
Error processing 'configurationDone' request. Unknown Error: 0x80131c30
使用这个 cli:
dotnet build Mm.ExportableDataGrid\Mm.ExportableDataGrid.csproj
dotnet build Mm.ExportableDataGrid.Wpf\Mm.ExportableDataGrid.Wpf.csproj
我收到以下错误:
CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [C:\Users\userid\C-Sharp Projects\ExportableDataGrid\mm.exportabledatagrid.wpf\mm.exportabledatagrid.wpf.csf.csproj]
C:\Users\userid\C-Sharp Projects\ExportableDataGrid\mm.exportabledatagrid.wpf\MainWindow.xaml.cs(13,13): error CS0103: The name 'InitializeComponent' does not exist in the current context [C:\Users\userid\C-Sharp Projects\ExportableDataGrid\mm.exportabledatagrid.wpf\mm.exportabledatagrid.wpf.csproj]
C:\Users\userid\C-Sharp Projects\ExportableDataGrid\mm.exportabledatagrid.wpf\MainWindow.xaml.cs(52,13): error CS0103: The name 'dataGrid' does not exist in the current context [C:\Users\userid\C-Sharp Prp Projects\ExportableDataGrid\mm.exportabledatagrid.wpf\mm.exportabledatagrid.wpf.csproj]
launch.json 和 tasks.json 都位于一个根文件夹中,其中包含来自 github 存档的两个文件夹。
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Custom .NET Launcher",
"type": "clr",
"request": "launch",
"preLaunchTask": "buildExe",
"program": "${workspaceFolder}/Mm.ExportableDataGrid.Wpf/bin/Debug/Mm.ExportableDataGrid.Wpf.exe",
"args": [],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label":"buildDll",
"type":"shell",
"command":"C:/\"Program Files (x86)/\"Microsoft Visual Studio\"/2019/BuildTools/MSBuild/Current/Bin/MSBuild.exe",
"presentation":{
"clear":true
},
"args":[
"Mm.ExportableDataGrid\\Mm.ExportableDataGrid.csproj",
"/t:Build",
"/p:Configuration=Debug",
"/p:Platform=\"AnyCPU\""
]
},
{
"label":"buildExe",
"type":"shell",
"command":"C:/\"Program Files (x86)/\"Microsoft Visual Studio\"/2019/BuildTools/MSBuild/Current/Bin/MSBuild.exe",
"presentation":{
"clear":true
},
"dependsOn":"buildDll",
"args":[
"Mm.ExportableDataGrid.Wpf\\Mm.ExportableDataGrid.Wpf.csproj",
"/t:Build",
"/p:Configuration=Debug",
"/p:Platform=\"AnyCPU\""
]
}
]
}
尽管阅读了很多,但我无法弄清楚这里发生了什么。
- 如何调试 0x80131c30 错误?
- 为什么会出现 CS5001 错误?
另外 - 我能够在没有调试的情况下运行,没有问题。似乎是附加调试器的问题。
【问题讨论】:
-
没有任务
buildExe -
我的错,有但我不小心把它从帖子里剪掉了。已更新。
标签: c# json visual-studio-code vscode-debugger vscode-tasks