Troubleshooting “program does not contain a static 'Main' method” when it clearly does…?

后端 未结 14 1791
Happy的楠姐
Happy的楠姐 2020-11-30 08:39

My MS Visual C# program was compiling and running just fine. I close MS Visual C# to go off and do other things in life.

I reopen it and (before doing anything else)

14条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-30 08:52

    I had this problem and its because I wasnt using the latest version of C# (C# 7.3 as of writing this) and I had to change the below internal access modifier to public.

    internal class Program
     {
        public static void Main(string[] args)
        {
            //My Code
        }
      }
    

    or ammend the .csproj to use the latest version of C# (this way meant I could still keep the above class as internal):

    
        latest
        true
    
    

提交回复
热议问题