为什么从VS Code运行.NET Core应用程序会导致发生错误? [英] Why does running a .NET Core application from VS Code cause an error to occur?

查看:54
本文介绍了为什么从VS Code运行.NET Core应用程序会导致发生错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从VS Code 1.8.1版内部运行.NET Core 1.1版应用程序.当我按F5按钮时,控制台出现在屏幕底部.启用跟踪后,我得到以下输出:

I am trying to run a .NET Core version 1.1 application from inside VS Code version 1.8.1. When I push the F5 button, the console appears at the bottom of the screen. After enabling tracing, I get this output:

读取fx解析程序目录= [C:\ Program Files \ dotnet \ host \ fxr]考虑到fxr version = [.] ...考虑到fxr version = [..] ...考虑到fxr version = [1.1.0] ...检测到最新的fxr版本= [C:\ Program Files \ dotnet \ host \ fxr \ 1.1.0] ...已解决的fxr[C:\ Program Files \ dotnet \ host \ fxr \ 1.1.0 \ hostfxr.dll] ...已加载的库从C:\ Program Files \ dotnet \ host \ fxr \ 1.1.0 \ hostfxr.dll跟踪已启用---调用了hostfxr [提交哈希:928f77c4bc3f49d892459992fb6e1d5542cb5e86]主拥有的DLLpath = [C:\ Program Files \ dotnet \ dotnet.dll]检查CoreCLR路径是否存在= [C:\ Program Files \ dotnet \ coreclr.dll]正在检测模式... CoreCLR存在于自己的目录[C:\ Program Files \ dotnet]中,并检查是否当前[dotnet.deps.json]文件= [0]---在split/FX模式下执行...检测到非独立应用程序,期望app.dll执行.应用程序"build"不是托管可执行文件.

Reading fx resolver directory=[C:\Program Files\dotnet\host\fxr] Considering fxr version=[.]... Considering fxr version=[..]... Considering fxr version=[1.1.0]... Detected latest fxr version=[C:\Program Files\dotnet\host\fxr\1.1.0]... Resolved fxr [C:\Program Files\dotnet\host\fxr\1.1.0\hostfxr.dll]... Loaded library from C:\Program Files\dotnet\host\fxr\1.1.0\hostfxr.dll Tracing enabled --- Invoked hostfxr [commit hash: 928f77c4bc3f49d892459992fb6e1d5542cb5e86] main Own DLL path=[C:\Program Files\dotnet\dotnet.dll] Checking if CoreCLR path exists=[C:\Program Files\dotnet\coreclr.dll] Detecting mode... CoreCLR present in own dir [C:\Program Files\dotnet] and checking if [dotnet.deps.json] file present=[0] --- Executing in split/FX mode... Detected a non-standalone application, expecting app.dll to execute. Application 'build' is not a managed executable.

此外,屏幕顶部会显示一个栏:

Also, a bar appears at the top of the screen that says:

preLaunchTask的"build"以退出代码2147516564终止.

The preLaunchTask 'build' terminated with exit code 2147516564.

当我单击显示问题"选项时,将出现一个空白问题标签,其中包含以下消息:

When I click the "show problems" option, a blank problems tab appears that contains the message:

到目前为止,尚未在工作区中检测到任何问题.

No problems have been detected in the workspace so far.

为什么VS Code拒绝构建项目,为什么没有问题消息?我之所以仅将其发布在SO上,是因为Google并没有帮助,并且因为VS Code GitHub页面建议首先在此处提出问题.

Why is VS Code refusing the build the project, and why are there no problem messages? I am only posting this on SO, because Google was not helpful, and because the VS Code GitHub page recommends asking questions here first.

更新此问题是由我将coreclr.dll放入C:\ Program Files \ dotnet引起的.我这样做是因为与构建应用程序有关的另一个问题.我以为,由于输出提到它正在此目录中查找,因此将此文件放在此处可能会有所帮助.事实证明,这是一个非常糟糕的主意,因为它使问题变得更加复杂!大声笑!

UPDATE This problem was caused by me having put coreclr.dll in C:\Program Files\dotnet. I did this, because of a different problem related to building the app. I thought that, since the output mentions it is looking in this directory, it might be helpful to put this file here. It turns out that this was a very bad idea, as it just complicated the problem! LOL!

推荐答案

如果在以下方面有问题,则会出现此错误:

You can get this error if you have problems in:

  • 软件包-请检查所有软件包是否都正确并且已成功还原
  • 核心版本-检查核心是否安装了正确的版本
  • .net工具-请检查.net工具的版本是否正确.

可以尝试Visual Studio吗?

Can you try visual studio?

这篇关于为什么从VS Code运行.NET Core应用程序会导致发生错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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