Cs5001 Error
Contents |
an entry point Visual Studio Languages , .NET Framework > Visual C# csc error cs5001 Question 0 Sign in to vote Trying to compile RemoteUpload.cs error cs5001 visual studio (http://code.msdn.microsoft.com/CSASPNETRemoteUploadAndDown-a80b7cb5/sourcecode?fileId=21989&pathId=205455091) using "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:exe /r:system.dll /out:RemoteUpload.exe f:\RemoteUpload.cs I'm getting: error CS5001: Program 'c:\WINDOWS\Microsoft.NET\Framework\RemoteUpload.exe' does not contain asp.net 5 program does not contain a static 'main' method suitable for an entry point a static 'Main' method suitable for an entry point How could I add Main method to the code so that it could compile and get does not contain a static main method c# console application the executable? Thanks. Tuesday, November 13, 2012 6:10 PM Reply | Quote Answers 1 Sign in to vote This will need to be compiled as a DLL, not an EXE. The error (that there is no "Main" method) basically is saying that you don't have any logic for how to use the
Visual Studio Program Does Not Contain A Static Main Method
type as a program - it's just the type (a library). Reed Copsey, Jr. - http://reedcopsey.com If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful". Proposed as answer by Lisa ZhuMicrosoft contingent staff, Moderator Thursday, November 15, 2012 5:35 AM Marked as answer by Lisa ZhuMicrosoft contingent staff, Moderator Tuesday, November 20, 2012 9:57 AM Tuesday, November 13, 2012 6:24 PM Reply | Quote Moderator 0 Sign in to vote The upload and download code is not meant to produce an exe - it's part of an ASP application. You could possibly compile them as library routines (i.e. as dll) then write an app that uses them. Alternatively, write an app and copy/paste the code into it (or use VS to add existing files).Regards David R --------------------------------------------------------------- The great thing about Object Oriented code is that it can make small, simple problems look like l
not contain a static ‘Main' method suitable for an entry point"? by Raju•June 15, 2014•0 Comments If
A Project With An Output Type Of Class Library Cannot Be Started Directly
we want to create an executable from your ‘C#' project or c# main method file, our code should contain a ‘static Main' method. This is the entry point to ‘C#' program. If metadata file could not be found our code missed this, ‘C#' will throw the below error: error CS5001: Program 'xyz.exe' does not contain a static 'Main' method suitable for an entry point To resolve https://social.msdn.microsoft.com/Forums/vstudio/en-US/dcf80197-03d6-443e-9a72-19a5489011df/cs5001-does-not-contain-a-static-main-method-suitable-for-an-entry-point?forum=csharpgeneral this, we have two options here. One is, add ‘static Main' method into the project or the class. Entry point for standalone ‘C#' application is its ‘Main' method. ‘static Main' method should exist in any one class in ‘C#' project or file. Build the project or file as a library (DLL - Dynamic Link Library). These http://codesteps.com/2014/06/15/c-how-to-fix-error-cs5001-program-xyz-exe-does-not-contain-a-static-main-method-suitable-for-an-entry-point/ type of files are not self-executable. DLL files will be used into other assemblies or applications. So, for these file, ‘Main' entry point is not required. Lets take a simple example to produce the error and discuss about the steps to resolve the issue. // Sample.cs public class Sample { public void Display() { System.Console.WriteLine("Hello, World!"); } }; When we compile above program; ‘C#' compiler will throw below error: c:\>csc Sample.cs Microsoft (R) Visual C# Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 Copyright (C) Microsoft Corporation. All rights reserved. error CS5001: Program 'c:\Sample.exe' does not contain a static 'Main' method suitable for an entry point c:\> As we mentioned above, we have two ways to resolve this problem. Lets try to resolve this without modifying any code. Compile the above program "Sample.cs" as a target library instead of an executable. Below is the command: c:\>csc /target:library Sample.cs Microsoft (R) Visual C# Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 Copyright (C) Microsoft Corporation. Al
have no idea! Go to Page... Thread Tools Display Modes Oct 24th, 2006, 5:36 PM #1 aff1993 Newbie Join Date: Oct 2006 Location: Australia Posts: 9 Rep Power: 0 Error CS5001 while http://www.programmingforums.org/thread11682.html compiling, i have no idea! Hello, I am new to C# so please dont reply using confusing language, i have made a program but everytime i debug i get 1 error saying: Build started. Compiling IconEditor error CS5001: Program 'c:\Documents and Settings\Tony\My Documents\SallyIDE C#\Sally IDE Source Code\IconEditor\obj\Debug\TestProject.exe' does not contain a static 'Main' method suitable for an entry point Build failed. Now, the area where i believe code is is here: public class MyApplication does not { public static MainForm MyMainForm=null; private static string moduleDir=""; [STAThread] public static void Main(string[] args) { Application.EnableVisualStyles(); Application.DoEvents(); moduleDir=Path.GetDirectoryName(Application.ExecutablePath); MyMainForm=new MainForm(); if (args.Length>0) { string ext=Path.GetExtension(args[0]).ToLower(); if (ext==Globals.ProjectExtension) MyMainForm.LoadProject(args[0]); else if (ext==Globals.SolutionExtension) MyMainForm.LoadSolution(args[0]); } Application.Run(MyMainForm); } public static string ModuleDir { get { return moduleDir; } } } I dont know how to fix it i just need some help, if you need anymore code, or if you could be really nice and does not contain take my source and fix it, that would be great, just message me. Thanks:banana: aff1993 View Public Profile Find More Posts by aff1993 Oct 24th, 2006, 5:58 PM #2 DaWei Resident Grouch Join Date: Jun 2005 Posts: 8,368 Rep Power: 21 Please read the forum's rules/FAQ, particularly with regard to the use of code tags. It's the polite thing to do when you join a community to ask for help. __________________ Contributor's Corner: Politically Incorrect DaWei on Pointers DaWei View Public Profile Visit DaWei's homepage! Find More Posts by DaWei Oct 24th, 2006, 7:28 PM #3 Samuaijack Programmer Join Date: Jul 2006 Location: using Earth.Africa.Egypt.Cairo; Posts: 76 Rep Power: 11 >>>Application.Run(MyMainForm); try entering new before MyMainForm: Application.Run(new MyMainForm()); Samuaijack View Public Profile Find More Posts by Samuaijack Oct 25th, 2006, 3:28 AM #4 Arevos Programming Guru Join Date: Aug 2005 Location: England Posts: 1,499 Rep Power: 13 That's not it, Samuaijack. MyMainForm is an reference to an object, rather than a class. It would help if the author used code tags, but I don't see anything wrong with the program itself. I suspect something is wrong with the configuration of aff1993's IDE. My advice would be to try and first get a simple Hello World console progra