The default value is automatic update, But I think manual update is more rational.
To manually update an instance, you only need to disable the "the application shocould check for updates" option in update.
Therefore, manually updatedCodeThis code is from the eLearning video. I wrote it down and shared it with you.
1 If (Applicationdeployment. isnetworkdeployed = True )
2 {
3 Applicationdeployment thisdeployment = Applicationdeployment. currentdeployment;
4 This . Text = " Updating being detected " ;
5 If (Thisdeployment. checkforupdate () = True )
6 {
7 If (MessageBox. Show ( " It is detected that a new version can be updated. Do you need to update it now? " , " Select whether to update " , Messageboxbuttons. yesno, messageboxicon. Information) = Dialogresult. Yes)
8 {
9 This . Text = " Updating... " ;
10 Thisdeployment. Update ();
11 MessageBox. Show ( " Update completed and will be restartedProgram! " );
12 Application. Restart ();
13 }
14 Else
15 {
16 This . Text = Application. productname + " " + Application. productversion;
17 }
18 }
19 Else
20 {
21MessageBox. Show ("No new version is available!");
22}
23 }
24 Else
25 MessageBox. Show ( " This is not a program released on the network. " );
Clickonce is indeed very convenient, making winfrom easy to deploy and update. however, in my actual use, I found that it was still somewhat unstable and prone to errors during release. after VS was disabled, I could compile it again. However, the version was automatically downgraded to a level, I hope vs SP1 can correct these errors...