Visual Studio delay between multiple startup projects?

前端 未结 9 1308
暖寄归人
暖寄归人 2021-02-06 23:31

how to add some delay between startup projects in solution?

\"enter

I want Client

9条回答
  •  梦毁少年i
    2021-02-07 00:00

    Why don't you just pass an argument to the client application which sets the delay?

    static void main(string[] args)
    {
      // Sleep some time
      int delay;
      if (args.Length > 0 && int.TryParse(args, out delay))
      {
        Thread.Sleep(delay);
      }
    
      // Initialize client
    }
    

    Now you can add the delay in milliseconds to the command-line arguments for the project startup.

    I also agree that if possible, it's better to solve your problem structurally, so it doesn't matter when your client and server start.

提交回复
热议问题