Hinzugefügt eine neue Klasse zu meinem Projekt und erhalten den Fehler " sagen Programm.Main() hat mehr als einen Eintrag, warum?

Das problem ist, dass nachdem ich fügte die neue Klasse, in der der Fehler kam, als ich Tat, erstellen Sie die Projektmappe. Was kann falsch sein ?

In Form1 ich habe keine code noch.

Nur Hinzugefügt neue Klasse:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenHardwareMonitor.Hardware;

namespace OpenHardwareMonitorReport
{

    class Program
    {

        static void Main(string[] args)
        {
            Computer computer = new Computer();
            computer.Open();

            var temps = new List<decimal>();
            foreach (var hardware in computer.Hardware)
            {
                if (hardware.HardwareType != HardwareType.CPU)
                    continue;
                hardware.Update();
                foreach (var sensor in hardware.Sensors)
                {
                    if (sensor.SensorType != SensorType.Temperature)
                    {
                        if (sensor.Value != null)
                            temps.Add((decimal)sensor.Value);
                    }
                }
            }

            foreach (decimal temp in temps)
            {
                Console.WriteLine(temp);
            }
            Console.ReadLine();
        }
    }
}

Dann sehe ich das Programm.cs und Fehler auf der Main()

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace NvidiaTemp
{
    static class Program
    {
        ///<summary>
        ///The main entry point for the application.
        ///</summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

Error   2   Program 'D:\C-Sharp\NvidiaTemp\NvidiaTemp\NvidiaTemp\obj\x86\Debug\NvidiaTemp.exe' has more than one entry point defined: 'NvidiaTemp.Program.Main()'.  Compile with /main to specify the type that contains the entry point.   D:\C-Sharp\NvidiaTemp\NvidiaTemp\NvidiaTemp\Program.cs  14  21  NvidiaTemp
  • Sie haben zwei Main jetzt.
  • Dank der festen tnx.
InformationsquelleAutor user1544479 | 2012-07-31
Schreibe einen Kommentar