我正在使用Visual Studio Code构建和运行C#应用程序。我一直在使用C#扩展0.3.7没有任何问题。今天,我将扩展更新为1.2.1,应用程序不再运行。
当我尝试使用.Net Core Launcher运行应用程序时,我看到以下消息:
在命令选项板中运行'Debug:Download .NET Core Debugger'或打开.NET项目目录以下载.NET Core Debugger
当我打开Command Palette并运行此命令时,我看到了这个错误:
C:\ Users \ martin.vscode \ extensions \ ms-vscode.csharp-1.2.1 \ coreclr-debug \ project.json
中的错误printf 'Processing: '
# Start the spinner in the background.
# The background job's PID is stored in special variable `$!`.
(while :; do for c in / - \\ \|; do printf '%s\b' "$c"; sleep 1; done; done) &
# Run the synchronous (blocking) command.
# In this example we simply sleep for a few seconds.
sleep 3
# The blocking command has finished:
# Print a newline and kill the spinner job.
{ printf '\n'; kill $! && wait $!; } 2>/dev/null
echo Done.
以下是coreclr-debug目录中project.json文件的框架片段:
The project 'coreclr-debug' does not specify any target frameworks in 'C:\Users\martin\.vscode\extensions\ms-vscode.csharp-1.2.1\coreclr-debug\project.json'.
我也尝试过再次升级到版本1.2.2,但看到的错误基本相同。关于发生了什么的任何想法?
答案 0 :(得分:1)
从我所见,微软在C:\Program Files\dotnet
文件夹中弄得一团糟。运行dotnet --info
以查看问题所在(如果您收到错误,那么您的版本较旧)。
我的解决方案是删除整个dotnet文件夹,然后再次运行SDK的安装程序,并使用修复。它之后起作用(在我清理现有的二进制文件和.vscode文件夹并重新运行dotnet恢复之后)。
答案 1 :(得分:0)
您好,在更新C#库后,您的解决方案中可能存在一些依赖性冲突。
尝试:
dotnet restore //restore dependencies
dotnet build ///build solution
dotnet run //run solution