Does not contain a static 'Main' method suitable for an entry point_

Hello
I want to to do a project with Entiity Framework . I add a project to my solution for my domain class and it's name is 'LinkModel.DomainClasses'.  when I prees F5 there is an error like bellow.
Could You help me to solve this? thanks alot
..\Documents\Training\LinkCodeFirstLast\LinkCodeFirst\LinkCodeFirst\LinkModel.DomainClasses\obj\Debug\LinkModel.DomainClasses.exe'
does not contain a static 'Main' method suitable for an entry point

Hi bkshn,
This error is caused by the missing "Main" method in your project. it is the entry point of your project.
If you want to create a EF project, you could follow the way in the aricle below.
https://msdn.microsoft.com/en-us/data/ee712907#codefirst
The Main method is like below.
class Program
static void Main(string[] args)
using (var db = new BloggingContext())
// Create and save a new Blog
Console.Write("Enter a name for a new Blog: ");
var name = Console.ReadLine();
var blog = new Blog { Name = name };
db.Blogs.Add(blog);
db.SaveChanges();
// Display all Blogs from the database
var query = from b in db.Blogs
orderby b.Name
select b;
Console.WriteLine("All blogs in the database:");
foreach (var item in query)
Console.WriteLine(item.Name);
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
And you could start to learn the EF from the following MSDN blogs.
https://msdn.microsoft.com/en-us/data/ee712907
If you have any other concern regarding this issue, please feel free to let me know.
Best regards,
Youjun Tang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Projectname.exe' does not contain a static 'Main' method suitable for an entry point .

    Hi,
    I'm developing a blog reader for windows 8 store app. It was perfectly worked before. But because of some miss behave my coding i get below error. No other errors there.
    Error    1    Program 'c:\Users\.........\Desktop\Blog_Reader\Blog_Reader\obj\Release\intermediatexaml\Blog_Reader.exe' does not contain a static 'Main' method suitable for an entry point    C:\Users\..........\Desktop\Blog_Reader\Blog_Reader\CSC  
     Blog_Reader
    Please help me to figure this.
    Thank You!

    Go to your App.Xaml and R-Click Go to Properties
    Check whether the Build Action is ApplicationDefinition
    If not change it to ApplicationDefinition. Clean the code (solution ) and Deploy..
    Chears....

  • Solution for Windows Store app "projectname.exe" does not contain a static 'Main' method suitable for an entry point . Error.

    Hi,
    I'm developed a blog reader for windows 8 store app. It was perfectly worked before. But suddenly it started to miss behave and I got an
    error. No other errors were there other than that.
    Error 
    Program c:\Users\.........\Desktop\Blog_Reader\Blog_Reader\obj\Release\intermediatexaml\Blog_Reader.exe' does not contain a static 'Main'
    method suitable for an entry point. 
    C:\Users\..........\Desktop\Blog_Reader\Blog_Reader\CSC    Blog_Reader
    But I found the solution while I fixing it.
    Solution for that is like below.
    Go to your App.Xaml and Right-Click thenGo to Properties
    Check whether the Build Action is
    ApplicationDefinition
    If not change it to ApplicationDefinition.
    Clean the code (solution) and Deploy
    Now the error is fiexed.

    Hi Robana, 
    Good sharing on the Technet. 
    This will definitely benefit other who may encounter the same issue as yours.
    Thanks for your sharing again. 
    Kate Li
    TechNet Community Support

  • File Screening Audit Report does not contain any data : report statistics is empty

    Hi ,
     I have enabled File screen audit and Record file screening activity in auditing database options in file server 2008. 
    I am getting details of file screen audit in Event log  , But incident report file screen audit report does not contain any value.
    Getting report for each incident of file screen audit  , But it does not contain any data in report statistics.
    Data available in scheduled report of file screen audit.. not available in incident report only..
    Please assist...
    Thanks,
    Vasanth.M
    Thanks, Vasanth.M.

    Please note that, If the Record file screening activity in the auditing database check box is cleared, the File Screening Audit Reports will not contain any information. To configure file screen audit, I would refer you on this informative
    technet library :
    https://technet.microsoft.com/en-us/library/cc754540.aspx
    Carlo

  • ITC - Build 1.x.x does not contain the correct beta entitlement.

    Hi,
    I have a major problem when uploading Builds via the Application Loader (2.9.1) to iTC.
    - I use Flash CC 2014 to create my iOS Apps.
    - I recreated my certificates, p12 and mobile provisioning profiles.
    - I can Upload my Builds via Application Loader without any error messages. Everything is fine here!
    - Then in iTC it takes several minutes (5-45) until the Apps Appear.
    - I am able to "Add a Build" in the first "Versions" Menu!
    BUT in "Prerelease" it looks like this:
    ... all Builds are marked as "Invalid Binary"
    Message: "Build 1.2.2 does not contain the correct beta entitlement. For more information, see the iTunes Connect Developer Guide."
    Even though all Builds are marked as "Invalid" they can be selected and I can submit them for review.
    ... the sad thing is - another App with the same Status "Invalid Binary" is waiting for review for almost 2 weeks now and nothing happens.
    Can anyone please tell me what I have to do? It seems Apple does not review Apps with this Status . Normally I get an email from iTUnes connect saying something like:
    "Dear developer,
    We have discovered one or more issues with your recent delivery for "XYZ". To process your delivery, the following issues must be corrected:
    ... but this time - NOTHING! :-(
    Please help!
    Thanks
    Jan

    You are likely to get better replies by asking in the developer forums (this forum is for questions about using/buying from the store) : https://devforums.apple.com/index.jspa

  • Eclipse problem selection does not contain main type

    i m using eclipse3.3 and have set all the necessary paths in it
    but when i run a simple java program just for displaying hello world but
    the error comes
    selection does not contain main type

    You must have a class with a main method.
    The main method must be public, must be static, must return void, must have parameter String [], and is case sensitive (so does Java).
    Put this into your class
    public static void main(String args[]) {
    }Let me know if it answers your question.
    Best regards.

  • [Eclipse Problem] Selection does not contain a main type?

    well i am using a GUI builder software which generates java code, i made a simple one to test and it will not compile.
    import java.awt.*;
    import javax.swing.*;
    public class name  {
         @SuppressWarnings("unused")
         private void initComponents() {
              panel1 = new JPanel();
              label1 = new JLabel();
              textField1 = new JTextField();
              panel1.setLayout(new FlowLayout());
              label1.setText("Name:");
              label1.setHorizontalAlignment(SwingConstants.LEFT);
              panel1.add(label1);
              textField1.setColumns(12);
              textField1.setText("hi");
              panel1.add(textField1);
         private JPanel panel1;
         private JLabel label1;
         private JTextField textField1;
    }it should make a basic swing GUI but it just gives me the error "Selection does not contain a main type"
    I did not select in eclipse "use public static void main" i know im not supposed to because this has no main method, but how am i to compile this? =X
    Edited by: -Johnny- on May 14, 2008 6:44 PM
    Edited by: -Johnny- on May 14, 2008 6:44 PM

    -Johnny- wrote:
    ya i used javac instead of eclipse then running it complains like you say
    but is there any way to compile this code and it will work? I was hoping to use this GUI builder for business purposes but it seems like a waste of money so far if i can't make working java application with it =\The code is fine. You need to learn the basics. Start with the intro tutorials at the Sun type and start reading and coding.
    Here is what the rest could look like:
    import java.awt.*;
    import javax.swing.*;
    public class name
        @SuppressWarnings("unused")
        private void initComponents()
            panel1 = new JPanel();
            label1 = new JLabel();
            textField1 = new JTextField();
            panel1.setLayout(new FlowLayout());
            label1.setText("Name:");
            label1.setHorizontalAlignment(SwingConstants.LEFT);
            panel1.add(label1);
            textField1.setColumns(12);
            textField1.setText("hi");
            panel1.add(textField1);
        private JPanel panel1;
        private JLabel label1;
        private JTextField textField1;
        public name()
            initComponents();
        public JPanel getPanel()
            return panel1;
        private static void createAndShowUI()
            JFrame frame = new JFrame("name");
            frame.getContentPane().add(new name().getPanel());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    createAndShowUI();
    }Edited by: Encephalopathic on May 14, 2008 7:10 PM

  • Source2wsdd: ServiceGen does not contain a start method - help!

    Hello all Weblogic Users!
    I would greatly appreciate any help with this problem.
    I am getting this error when I do my build on Linux.
    [source2wsdd] source2wsdd: Doclet class weblogic.webservice.tools.ddgen.ServiceGen does not contain a start method.
    Previously I was getting an error where the ServiceGen class could not be found. This was occuring both in Windows and Linux.
    For Windows, this can be fixed in two ways. 1) Run setWLSEnv.cmd first (in weblogic81/server/bin. 2) (Unconfirmed but try it) Add the tools.jar, weblogic.jar, and webservices.jar to the ant runtimes lib in Eclipse (see preferences/ant/runtimes/global entries. - This will let you run the task inside Eclipse)
    In Linux, I added the webloigc.jar and webservices.jar to the user's special ~/'.ant/lib directory (see ant documentation). This too fixed the problem of being unable to find the ServiceGen class. But now I am getting the error above. I am ripping my hair out trying to fix it.
    Any help would be appreciated.
    Thanks to all....

    Hi bkshn,
    This error is caused by the missing "Main" method in your project. it is the entry point of your project.
    If you want to create a EF project, you could follow the way in the aricle below.
    https://msdn.microsoft.com/en-us/data/ee712907#codefirst
    The Main method is like below.
    class Program
    static void Main(string[] args)
    using (var db = new BloggingContext())
    // Create and save a new Blog
    Console.Write("Enter a name for a new Blog: ");
    var name = Console.ReadLine();
    var blog = new Blog { Name = name };
    db.Blogs.Add(blog);
    db.SaveChanges();
    // Display all Blogs from the database
    var query = from b in db.Blogs
    orderby b.Name
    select b;
    Console.WriteLine("All blogs in the database:");
    foreach (var item in query)
    Console.WriteLine(item.Name);
    Console.WriteLine("Press any key to exit...");
    Console.ReadKey();
    And you could start to learn the EF from the following MSDN blogs.
    https://msdn.microsoft.com/en-us/data/ee712907
    If you have any other concern regarding this issue, please feel free to let me know.
    Best regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • C# compiling error: 'System.Array' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)

    Hello experts,
    I'm totally new to C#. I'm trying to modify existing code to automatically rename a file if exists. I found a solution online as follows:
    string[] allFiles = Directory.GetFiles(folderPath).Select(filename => Path.GetFileNameWithoutExtension(filename)).ToArray();
            string tempFileName = fileName;
            int count = 1;
            while (allFiles.Contains(tempFileName ))
                tempFileName = String.Format("{0} ({1})", fileName, count++); 
            output = Path.Combine(folderPath, tempFileName );
            string fullPath=output + ".xml";
    However, it gives the following compilation errors
    for the Select and Contain methods respectively.:
    'System.Array' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'System.Array' could be found
    (are you missing a using directive or an assembly reference?)
    'System.Array' does not contain a definition for 'Contains' and no extension method 'Contains' accepting a first argument of type 'System.Array' could be
    found (are you missing a using directive or an assembly reference?)
    I googled on these errors, and people suggested to add using System.Linq;
    I did, but the errors persist. 
    Any help and information is greatly appreciated.
    P. S. Here are the using clauses I have:
    using System;
    using System.Data;
    using System.Windows.Forms;
    using System.IO;
    using System.Collections.Generic;
    using System.Text;
    using System.Linq;

    Besides your issue with System.Core, you also have a problem with the logic of our code, particularly your variables. It is confusing what your variables represent. You have an infinite loop, so the last section of code is never reached. Take a look 
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.IO;
    namespace consAppFileManipulation
    class Program
    static void Main(string[] args)
    string fullPath = @"c:\temp\trace.log";
    string folderPath = @"c:\temp\";
    string fileName = "trace.log";
    string output = "";
    string fileNameOnly = Path.GetFileNameWithoutExtension(fullPath);
    string extension = Path.GetExtension(fullPath);
    string path = Path.GetDirectoryName(fullPath);
    string newFullPath = fullPath;
    string[] allFiles = Directory.GetFiles(folderPath).Select(filename => Path.GetFileNameWithoutExtension(filename)).ToArray();
    string tempFileName = fileName;
    int count = 1;
    //THIS IS AN INFINITE LOOP
    while (allFiles.Contains(fileNameOnly))
    tempFileName = String.Format("{0} ({1})", fileName, count++);
    //THIS CODE IS NEVER REACHED
    output = Path.Combine(folderPath, tempFileName);
    fullPath = output + ".xml";
    //string fullPath = output + ".xml";
    UML, then code

  • Eclipse "selection does not contain main type" - but it does contain a main

    Hi!
    I'm having a strange thing happen to me when using the eclipse IDE in a macintosh envirnment.
    I imported a project, complete with package, and all of my classes. and when I try to run my main class, it tells me "selection does not contain main type".
    Which is entirely untrue, the class I am trying to run contains a public static void main(), does anyone know what's going on here?

    the class is quite large, I don't think that it is a problem with the class, because it runs fine on my windows based pc (also in eclipse)...

  • Help - Editor does not contain a main type error (Eclipse)

    Hello,
    I'm trying to run a Text input program out of the Eclipse program and I keep getting this Editor does not contain a main type error - can someone help me
    here's the code
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.text.DecimalFormat;
    import java.util.Scanner;
    import uwcse.io.Input;
    public class FileInputExample {
         public static void main(String[] args) {
              // Create a Scanner to read the input file
              String fileName = new Input().readString("Input file name? ");
              System.out.println();
              Scanner scan;
              try {
                   scan = new Scanner(new File(fileName));
              } catch (FileNotFoundException e) {
                   System.out.println(fileName + " doesn't exist!");
                   return;
              // Read the file and count the number of occurences of A, B, ...
              int[] count = new int[26];
              while (scan.hasNextLine()) {
                   String line = scan.nextLine();
                   line = line.toLowerCase();
                   for (int i = 0; i < line.length(); i++) {
                        char c = line.charAt(i);
                        if (c >= 'a' && c <= 'z') {
                             count[c - 'a']++;
              scan.close();
              int length = 0;
              for (int i = 0; i < count.length; i++) {
                   length += count;
              // Display the statistics (as an histogram)
              DecimalFormat df = new DecimalFormat("0.00");
              for (int i = 0; i < count.length && length > 0; i++) {
                   double percent = count[i] * 100.0 / length;
                   String display = "" + (char) ('a' + i);
                   display += "(" + df.format(percent) + "%):\t";
                   for (int j = 1; j <= Math.round(percent); j++) {
                        display += "X";
                   System.out.println(display);
    }Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    First, note that your program uses a non-standard class, "uwcse.io.Input" which is not available to us. Normally that is a show stopper - in this case, it's not, as I was able to eliminate its use.
    Your program runs fine, so the error is an Eclipse error unrelated to Java.
    You need to ask for help at an Eclipse support site, not here, as these forums are Java language forums.

  • Error: The Java Runtime in use does not contain a suitable JAXP feature

    Hi,
    I'm trying to get Eclipse TPTP to work. One of the steps I need to execute is to run a setConfig.bat file. When I ran it, I got the following error:
    ERROR: The Java Runtime in use does not contain a suitable JAXP feature
    RESOLUTION: Use a JRE which supports the JAXP featureI use Eclipse Europa, and it is using my JDK (actually JRE) 1.6.0_05. That should mean I have JAXP in my JRE (which is confirmed when I search on JAXP from the directory C:\Program Files\Java containing jdk1.6.5_05 and jre1.6.5_05 directories).
    Is there something extra I need to do to let Eclipse and TPTP find my JAXP classes?
    TIA,
    Abel

    Hi,
    Even i am getting the same error but i use JRE 1.5.0_14. please let me know if you happen to resolve this.
    Thanks in Advance,
    Sai

  • Selection does not contain main type

    Hi All,
    I am getting the Launch error saying:
    "Selection does not contain main type" while running the program in eclipse.
    Is there any common aspects from where it is being generated?
    Thanks in advance
    regards

    lkarmacharya wrote:
    eclipse launch error: "editor doesn't contain a main type"Hi,
    Please don't resurrect old threads, and this isn't an eclipse forum. I'm locking this thread. Create a new one if you have a specific Java programming related problem.
    Kaj

  • StreamCorruptedException: does not contain a serialized object?

    Can someone tell me why am I getting this exception:
    C:\javapr>java FetchObject
    Couldn't retrieve binary data: java.io.StreamCorruptedException: InputStream
    does not contain a serialized object
    java.io.StreamCorruptedException: InputStream does
    not contain a serialized object
    at java.io.ObjectInputStream.readStreamHeader
    (ObjectInputStream.java:849)
    at java.io.ObjectInputStream.<init>
    (ObjectInputStream.java:168)
    at FetchObject.main(FetchObject.java:23)
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    class FetchObject implements Serializable {
        public static void main (String[] args) {
            try {
                String driver = "oracle.jdbc.driver.OracleDriver";
                Class.forName(driver);
                String url = "jdbc:oracle:thin:@mymachine:1521:homedeva";
                Connection conn = DriverManager.getConnection(url,"cnn","cnn");
                FetchObject i = new FetchObject();
                    // Select related
                    try
                         byte[] recdBlob = i.selectBlob( 1 , conn ); 
                         ByteArrayInputStream bytes = new ByteArrayInputStream(recdBlob);
                         ObjectInputStream deserialize = new ObjectInputStream( bytes );
              Employee x = (Employee)deserialize.readObject();
                    catch( Exception ex )
                  System.err.println("Couldn't retrieve binary data: " + ex);
                  ex.printStackTrace();
         catch( Exception ex )
              ex.printStackTrace();
        public byte[] selectBlob( int id, Connection conn )
         byte[] returndata = null;
         try
              Statement stmt = conn.createStatement();
              String sql = "SELECT id, rowdata FROM blobs WHERE id = " + id;
              ResultSet rs = stmt.executeQuery(sql);
              if ( rs.next() )
                           try
                               ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
                               BufferedInputStream bis = new BufferedInputStream( rs.getBinaryStream("rowdata") );
                             byte[] bindata = new byte[4096];
                               int bytesread = 0;
                               if ( !rs.wasNull() )
                                       if ( (bytesread = bis.read(bindata,0,bindata.length)) != -1 )
                                          baos.write(bindata,0,bytesread);
                                returndata = baos.toByteArray();
                             baos.flush();
                                bis.close();
                       catch ( Exception ex )
                            System.err.println("Problem retrieving binary data: " + ex);
                        rs.close();
                         stmt.close();  
               catch ( Exception ex )
                    System.err.println("Couldn't retrieve binary data: " + ex);
            return returndata;
    import java.io.*;
    class Employee implements Serializable
         private String lastName;
         private String firstName;
         public Employee(String lastName, String firstName)
              this.lastName = lastName; 
              this.firstName = firstName;
    }

    To clarify I have stored an Employee Object as a Blob in the Oracle database and am attempting to retreive the
    Employee Object from this Blob.
    Thanks

  • Certificate does not contain the correct site name

    Hello,
    I have to make a midlet that connect to a tomcat 5.5.9 server with ssl.
    I import the certificate whit tomcat alias in the wireless toolkit but when i run the midlet this error appear: Certificate does not contain the correct site name
    import java.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    public class HelloNet extends MIDlet implements CommandListener , Runnable{
    // User interface command to exit the current
    // application.
    private Command exitCommand = new Command("Exit",
    Command.EXIT, 2);
    // User interface command to issue an HTTP GET
    // request.
    private Command getCommand = new Command("Get",
    Command.SCREEN, 1);
    /// The current display object.
    private Display display;
    // The url to GET from the 'net.
    private String url;
    * Initialize the MIDlet with a handle to the
    * current display.
    public HelloNet() {
    url = "https://127.0.0.1:8443/Hello.txt";
         display = Display.getDisplay(this);
    * This lifecycle method should return immediately
    * to keep the dispatcher
    * from hanging.
    public void startApp() {
         showPrompt();
    * Display the main screen.
    void showPrompt() {
    String s = "Press Get to fetch " + url;
    TextBox t = new TextBox("Http Result", s,
    s.length(), 0);
    t.addCommand(exitCommand);
    t.addCommand(getCommand);
    t.setCommandListener(this);
         display.setCurrent(t);
    * pauseApp signals the thread to stop by clearing
    * the thread field.
    * If stopped incorrectly, it will be restarted from
    * scratch later.
    public void pauseApp() {
    * destroyApp must cleanup everything. The thread
    * is signaled
    * to stop and no result is produced.
    * @param unconditional is a flag to indicate that
    * forced shutdown
    * is requested
    public void destroyApp(boolean unconditional) {
    * commandAction responds to commands
    * @param c command to perform
    * @param s Screen displayable object
    public void commandAction(Command c, Displayable s) {
         if (c == exitCommand) {
         destroyApp(false);
         notifyDestroyed();
         } else if (c == getCommand) {
              Thread th= new Thread (this);
              th.start();
    * Read the content of the page.
    public void run() {
    TextBox t = null;
    StringBuffer b = new StringBuffer();
    HttpsConnection c = null;
    InputStream is = null;
         try {
         int len = 0;
         int ch = 0;
         System.out.println("Cerco di leggere");
    c = (HttpsConnection)Connector.open(url);
    c.setRequestMethod(HttpsConnection.GET);
         is = c.openInputStream();
    // length of content to be read.
    len = (int) c.getLength();
    if (len != -1) {
    // Read exactly Content-Length bytes
    for(int i=0; i<len; i++) {
    if((ch = is.read()) != -1) {
    b.append((char) ch);
    } else {
    // Read until connection is closed.
    while((ch = is.read()) != -1) {
    len = is.available();
    b.append((char) ch);
    t = new TextBox("Https Result", b.toString(),
    b.length(), 0);
         } catch (Exception e) {
    e.printStackTrace();
    String s = e.toString();
    if(s != null) {
    t = new TextBox("Https Error", s, s.length(),
    0);
    } finally {
    if (is != null) {
         try {
              is.close();
         } catch (Exception ce) { }
    if (c != null) {
         try {
              c.close();
         } catch (Exception ce) { }
    display.setCurrent(t);
    }

    re: code tags, please see http://forum.java.sun.com/help.jspa?sec=formatting.
    As for the rest:
    See, we now know that you used keytool to generate you certificate. You need a new certificate. This time, when keytool asks you for a first and last name, type 127.0.0.1.

Maybe you are looking for