Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > MSI question and help with code
 

MSI question and help with code

Could someone please guide/help me here. Ive created a class to call a ClickOnce update from. This code doesnt work and wondered if someone could shed some light here:

Heres the code

Public Function ClickOnceUpdate() As Boolean
Dim update As Boolean = False
AD = ApplicationDeployment.CurrentDeployment

Try
If AD.CheckForUpdate() Then
AD.Update()
Else
update = False

End If
Catch ex As Exception

End Try
Return update
End Function

I create the form code then publich this app. If there are no updates sent to the server the application crashes, if there is an update then the application does NOT update. Could someone help with this code please? Ive looked at the video on MSDN and cant still work it out??

Second: How or what do i need to update MSI applications? I have developed some applications created an MSI and now i would like these updated too. What class would i need? Any examples/videos on this?

Thanks in advance for any help.

EssCee  Thursday, February 26, 2009 3:10 PM
Hello, unfortunately this is not the answer i am looking for. My initial question was requiring help with the code i posted

"I believe i understand the procedure however the difficulty im having is trying to have the above code working which is in a dll."

Eventually i found the answer which was to use Me.VariableName.Update. This allows the dll to work as expected.

Thanks

  • Marked As Answer byEssCee Thursday, March 05, 2009 9:04 AM
  •  
EssCee  Thursday, March 05, 2009 9:04 AM

Hi EssCee,

As for your first question, refer to the following MSDN document for a samplewhich checks whether a new update is avaiblable and if yes, update asynchronously:
http://msdn.microsoft.com/en-us/library/system.deployment.application.applicationdeployment.aspx

As for your second question, you can use Major upgrade. To do this,
1. Open the setup project in Visual Studio.
2. Select the Setup project in the Solution Explorer and switch to Properties window.
3. Change the Version property to a new value and press Enter. A messagebox pops up asking if you would change the ProductCode. Answer Yes.
4. Set the RemovePreviousVersions property to true.
5. Build the Setup project.

When installing the resulting MSI package, it will remove previous version of this application on the target machine if any and then install the new version of application.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu

Linda Liu  Monday, March 02, 2009 9:55 AM
Thanks for your reply.

I appreciate the link you have posted above, which explains and demonstrates how to use ClickOnce. I believe i understand the procedure however the difficulty im having is trying to have the above code working which is in a dll.

The code shown in the above link works prefectly from a normal Visual Basic .Net application however not when i run it in a dll, therefore im unsure and would like some assistance on this?

Thanks in advance for any help you could provide.

EssCee  Monday, March 02, 2009 11:34 AM

Hi EssCee,

Thank you for your reply!

I create a class library project andpaste the MSDN sample code intoit.I create aWindows Forms application project and add a reference to the above class library project to this WinForms application project.

When the main form of the WinForms application loads, it calls the UdpateApplication method defined in the class library.

On my side, everything goes well, i.e. if there's a new version on the publish location, the application can detect this new version and download the new version.

Is there any difference between your scenario and mine?

Sincerely,
Linda Liu

Linda Liu  Wednesday, March 04, 2009 5:37 AM
Hello, unfortunately this is not the answer i am looking for. My initial question was requiring help with the code i posted

"I believe i understand the procedure however the difficulty im having is trying to have the above code working which is in a dll."

Eventually i found the answer which was to use Me.VariableName.Update. This allows the dll to work as expected.

Thanks

  • Marked As Answer byEssCee Thursday, March 05, 2009 9:04 AM
  •  
EssCee  Thursday, March 05, 2009 9:04 AM

You can use google to search for other answers

Custom Search

More Threads

• Execute custom action without installing the assembly.
• Setup Project: Execute vsi file inside the msi
• Application blocks with SmartClient apps
• deploying a package to multple users installAllusers set to true using Microsoft SMS
• how to uninstall a deployed web site completely?
• Driver developing
• ALLUSERS VS FolderForm_AllUsers
• Windows App Newbie Question
• VS 2005 Deployment Projct - "Installation is taking longer than expected"
• How to translate Setup Dialogs in Setup project