fix concurrent starts of NuGet.exe'
[teamcity/dotNetPackagesSupport.git] / nuget-extensions / nuget-commands / src / NuGetTeamCityPingCommand.cs
1 using System.Threading;\r
2 using NuGet;\r
3 using NuGet.Commands;\r
4 \r
5 namespace JetBrains.TeamCity.NuGet.ExtendedCommands\r
6 {\r
7   [Command("TeamCity.Ping", "Command that dump NuGet and TeamCity extension versions. It is used to check NuGet<->TeamCity communications")]\r
8   public class NuGetTeamCityPingCommand : Command\r
9   {\r
10     [Option("Makes command wait for 1000ms before exit. Used for testing")]\r
11     public bool Sleep { get; set; }\r
12 \r
13     public override void ExecuteCommand()\r
14     {\r
15       System.Console.Out.WriteLine("TeamCity NuGet Extension is available.");\r
16       System.Console.Out.WriteLine("NuGet Version = {0}", typeof(Command).Assembly.GetName().Version);\r
17       System.Console.Out.WriteLine("TeamCity Extension Version = {0}", GetType().Assembly.GetName().Version);\r
18       \r
19       if (Sleep)\r
20       {\r
21         Thread.Sleep(1000);\r
22       }\r
23     }\r
24   }\r
25 }