今天是我学习C#的第一天。我对Java和C很有经验,通常不会遇到我无法解决的问题。我一直害怕使用Visual Studio,因为当我用来运行我的汇编程序时,我会收到永无止境的错误。今天我想要运行一个简单的hello world
程序。运行程序后,我收到以下错误。
'dotnet.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\cansh_000\source\repos\Program\Program\bin\Debug\netcoreapp2.0\Program.dll'. Symbols loaded. 'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Console.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Runtime.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The program '[2852] dotnet.exe' has exited with code 0 (0x0).`
下面的代码
using System;
namespace Program
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
}
任何帮助将不胜感激
答案 0 :(得分:8)
该输出都不是错误消息。它说您的程序成功运行完成然后退出。程序完成后,C#编译器不会添加“按任意键继续...”消息,这与某些C编译器不同 - 因此在程序运行后它会消失,在屏幕上留下无痕迹。
查找您的void Main
,int Main
,(或async Task Main
)方法,并在结束大括号Console.WriteLine("done!"); Console.ReadLine();
之前添加}
。
答案 1 :(得分:1)
如前所说,你的程序运行正常。输出窗口在退出时关闭
您发布的信息消息表示您目前只调试自己的代码(Console.WriteLine("Hello World");
)而没有框架代码
这是'Just my Code'设置。您可以在工具>选项>调试>常规>启用我的代码下更改此内容。
答案 2 :(得分:1)