You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Mono中创建Hello World解决方案:构建成功却无运行按钮的问题

Fixing Your Mono Hello World Issue

Ah, I see exactly where you went wrong—you picked a Shared Project, which is not meant to be a standalone runnable application! Let me walk you through creating a proper console app that you can build and run in Mono:

First, the core issue: Shared Projects exist solely to share code across multiple other projects (like a console app and a GUI app). They don’t have an entry point (a Main method) and don’t produce an executable file, which is why you’re missing the run button and configuration options.

Here’s the step-by-step fix:

  1. Open your Mono IDE (most likely MonoDevelop) and go to File > New > Solution
  2. In the project template window, navigate to .NET > Console Application (skip the Shared Project option entirely). Name your project something like "HelloWorld" and choose a save location.
  3. Click "Create"—the IDE will generate a default Program.cs file with a Main method (this is your app’s required entry point).
  4. Modify the Main method to print your Hello World message. For example:
    using System;
    
    namespace HelloWorld
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World from Mono!");
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
            }
        }
    }
    
  5. You should now see a run button (a play icon) in the IDE toolbar. Click it, and your console app will launch, displaying your message in a terminal window.

If you ever need to reuse code across multiple Mono projects later, that’s when you’d add a Shared Project as a reference to those runnable apps—but it can never run on its own.

内容的提问来源于stack exchange,提问作者Thufir

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:56:32