compruebe la actualización en línea cuando abra el programa en C # [duplicado]

Posible duplicado:
Sugerir un método para actualizar automáticamente mi programa C #

I'm sorry if this question has been asked already. i have a problem whit online update because i don't know how can add code for check for update program and after check if find newer version upgrade itself.

However, every time I make changes to the program people will have to download the new version.

i have a host and no any problem whit host. well only i need add code for check for online update

how can add code for check for update when open program ? what can i do ? what do i do ? can u please help me ?

Por favor give me sample code or sample project for understand. thanks.

preguntado el 08 de noviembre de 11 a las 13:11

2 Respuestas

¿Has mirado el ClickOnce technology? This is automatically built-in to either

1) not check for updates
2) check for updates before the application starts or
3) check for updates after the application finishes.

It's a great way to circumvent your issues, and it's easy to implement.

Or if you want to manually do this, utilize the System.Reflection espacio de nombres y use el Assembly.GetExecutingAssembly().GetName().Version property to get the application's version. Then do whatever conditional comparison you need to do to see if that's the newest version, and if not then update the application.

respondido 08 nov., 11:17

When I wanted to implement something like this I made it really simple.

I downloaded a xml configuration file, parsed the file, and if xml document contained an update my program would download the file from my website. I broke up the xml document into files. Since you are able to get the version of assembly this was an effective way of doing it.

Since you have not even attempted to do it I will leave actually doing it as an exercise for you.

respondido 08 nov., 11:17

Why use a custom mechanism when ClickOnce is so easily used? In your case you've got a lot more work than just a couple of changes to the project settings. - Polinomio

@Polynomial - I wrote what I described 5 years ago. I also didn't understand how to create and publish a ClickOnce installer. In my case I also integrated a browser into my program and wrote a seperate updater application. - Sabueso de seguridad

That doesn't mean you should suggest it to anyone, let alone a novice programmer. - Polinomio

@Polynomial - It served my purpose and I wanted to share what I did, just because you disagree, does not mean its an invalid answer. - Sabueso de seguridad

I don't disagree that it's a valid mechanism for updating. It works, and it will do what OP wants. However, it's not good practice when there's a standardised mechanism for updates. It's even worse practice to recommend a non-standard mechanism to a novice programmer. It just gives de ellos bad practices. - Polinomio

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.