尝试建立第一个C#应用程序时失败 [英] Failed when trying to builld first C# application

查看:68
本文介绍了尝试建立第一个C#应用程序时失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是C#开发界的新来者.

Hello, i'm a newcomers of C# development world.

我试图使用C#构建一个简单的应用程序,如下所示:

I was tried to build a simple applications using C# as shown below : 

using System;

public class coba
{
    static void Main()
    {
        double width, height, woodlength, glassarea;
        string widthstring, heightstring;

        widthstring = Console.ReadLine();
        width = double.Parse(widthstring);

        heightstring = Console.ReadLine();
        height = double.Parse(heightstring);

        woodlength = 2 * (width + height) * 3.25;

        glassarea = 2 * (width * height);

        Console.WriteLine("Besarnya panjang kayu adalah(The length of the wood is) : " + woodlength + " kaki(feet)");

        Console.WriteLine("Besarnya luas kaca adalah(The area of the glass is) :" + glassarea + " meterpersegi(squaremeters)");
    }
}

当我尝试对其进行编译时,将显示错误消息,并指出参数名称:solutionDirectory上的值不能为null.我如何解决它,以便我可以编译上面的代码?我需要你的帮助.非常感谢印度尼西亚语.

When i tried to compile it, the Error message are shown and says that the Value cannot be null on Parameter name : solutionDirectory. How do i resolve it so i can compile the above code? I need your help. Thank you so much from Indonesia.

推荐答案

代码没有错.  您还没有解决方案/项目.  示例还提供了.csproj吗?  您不能只运行代码...还需要一个项目文件(.csproj文件).

There's nothing wrong with the code.  You just don't have a solution / project yet.  Did the sample also provide a .csproj?  You can't just run code...you need a project file (.csproj file) too.

如果没有.csproj,则可以创建一个新的C#控制台应用程序,并将Program.cs文件的内容替换为示例代码的文本.

If you don't have a .csproj, you can create a new C# console application and replace the Program.cs file's contents with the text of the sample code.


这篇关于尝试建立第一个C#应用程序时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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