0

I am trying to learn Squirrel.Windows so I can use it in my project so I am using this guide as a starter. They are using this simple Windows form project from their Github, so people who wants to follow can download it.

I can successfully run the project before editing anything. However, I am currently stuck in this early part of the guide. I followed the instructions given in a way like this:

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

            using (var mgr = new UpdateManager("MyApp_Root_Here\\Releases"))
            {
                await mgr.UpdateApp();
            }
        }
    }
}

And this error came out:

Program does not contain a static 'Main' method suitable for an entry point

I really don't know what was wrong with what I did.


EDIT :

After the above problem being temporarily fixed with the help of @Junior in the comments. I said temporarily because the error is only gone in the Debug build but no on the Release build.

LindaSingh
  • 84
  • 1
  • 13
  • What visual studio version are you using? (the year) – Junior May 14 '20 at 11:06
  • @Junior, VS 2017 Pro – LindaSingh May 15 '20 at 02:07
  • 1
    I suspect you need to enable C# 7.1 in Visual Studio. `async Task Main` is only supported in 2017 after an update. Have a read of this https://www.danielcrabtree.com/blog/329/c-sharp-7-1-everything-you-need-to-know – Junior May 15 '20 at 02:22
  • 1
    Also put `Application.Run(new Form1());` after the update check, because if you have it before the update check - it won't run until you close form1. – Junior May 15 '20 at 02:27
  • @Junior, thank you, the 7.1 version helped. – LindaSingh May 15 '20 at 04:10
  • @Junior, you have any idea why the same error still shows on Release build even if its no longer shows on Debug build? – LindaSingh May 15 '20 at 05:51
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/213909/discussion-between-lindasingh-and-junior). – LindaSingh May 15 '20 at 07:17
  • 1
    Step 1 of that link I provided earlier, try that step again after switching to release mode. I think it only applies to one at a time. – Junior May 15 '20 at 07:21

0 Answers0