Application.ProductVersion,命令应用程序的等价物是什么?

时间:2014-08-08 22:40:25

标签: c#

我试图添加更新'函数我创建的工具,我按照教程制作更新按钮,但我的应用程序是一个命令应用程序。我将所有的消息框更改为console.writeline,但有一部分不能正常工作。帮助

Console.WriteLine("Now Checking for updates.\nPlease be patient as we check for updates.");
                    WebRequest request = WebRequest.Create("http://WEBSITE.com/TEXT/FILE");
                    WebResponse response = request.GetResponse();
                    System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream());
                    string newestversion = sr.ReadToEnd();
                    string currentversion = ***Application***.ProductVersion;
                    Version vOnline = new Version(newestversion);
                    Version vLocal = new Version(currentversion);
                    if (vOnline > vLocal)
                    {
                        Console.WriteLine("Update Found!\nNewest Version: " + newestversion + ".");
                    }
                    else if (vLocal == vOnline)
                    {
                        Console.WriteLine("No Updates Found.\nYou are on the newest version.");
                    }
                    else if (vLocal > vOnline)
                    {
                        Console.WriteLine("No Updates Found.\nYou are on a pre-release version of the program.");
                    }

我应该使用什么而不是应用程序来使其工作?我是C#的新手,所以对任何帮助表示赞赏!

0 个答案:

没有答案