VS 创建 .Net Core 控制台项目时遇到的问题

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/Jamesika/article/details/83346332

1. C# net.core 无法启动程序dotnet.exe

添加PATH环境变量 C:\Program Files\dotnet

2. F5调试时控制台瞬间退出, 无法正常调试

退出的瞬间显示了些错误报告, 但是由于控制台直接退出了所以看不清. 所以打开Cmd, 进入VS项目文件夹, 用 dotnet run 运行, 得到以下提示:

It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '1.1.2' was not found.
  - Check application dependencies and target a framework version installed at:
      C:\Program Files\dotnet\
  - Installing .NET Core prerequisites might help resolve this problem:
      http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
  - The .NET Core framework and SDK can be installed from:
      https://aka.ms/dotnet-download
  - The following versions are installed:
      2.0.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.1.5 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

察觉到应该是项目属性设置的问题, 右键项目->属性, 目标框架改成现有的 .Net Core 2.1, 问题解决.

展开阅读全文

没有更多推荐了,返回首页