Clickonce deployment issues

jamie_pattison

Well-known member
Joined
Sep 9, 2008
Messages
116
Programming Experience
Beginner
Im trying to deploy an application by using clickonce and having some difficulties with it. In a class i have this function


VB.NET:
    Private AD As ApplicationDeployment
    Private updateCheck As UpdateCheckInfo

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

        If AD.CheckForUpdate Then
         If updateCheck.AvailableVersion.Build > AD.CurrentVersion.Build Then
		' Install updates
        End If
        End If
        Return updateCheck 
    End Function

When i create my code on a form (to run the function above) i receive the error "Object not set to an instance" I try to add New to my declaration but then receive the error "Application Deployment has no constructors".

Im not sure what im doing wrong or how i should go about this. I know the code is not complete but since it does not go past the line AD = ApplicationDeployment.CurrentDeployment i decided to leave the remaining code

Could someone advise please?

Many Thanks
 
Last edited:
i receive the error "Object not set to an instance" I try to add New to my declaration but then receive the error "Application Deployment has no constructors"
Was it really the AD (ApplicationDeployment) variable that was Nothing? Not likely. updateCheck (UpdateCheckInfo) in your code is never set. Have a look at the code example in help for UpdateCheckInfo class.
since it does not go past the line AD = ApplicationDeployment.CurrentDeployment
If it stops there it is not because of Nullref-exception, it will be a InvalidDeploymentException.
 
Thank you. I have now added the below line but before i publish it i receive the Error "Application is not installed." when trying to debug it in design.

Once installed (after publishing it) it seems to run. Is there a way to test it in design before publishing it? As this way will help me understand what and where im going wrong?

VB.NET:
    Private AD As ApplicationDeployment
    Private updateCheck As UpdateCheckInfo

    Public Function SoftwareUpdate() As Boolean
        Dim update As Boolean
        
        AD = ApplicationDeployment.CurrentDeployment
        updateCheck = AD.CheckForDetailedUpdate

        If AD.CheckForUpdate Then
         If updateCheck.AvailableVersion.Build > AD.CurrentVersion.Build Then
		' Install updates
        End If
        End If
        Return updateCheck 
    End Function
 
Is there a way to test it in design before publishing it?
No, because it isn't deployed. You can install to development computer to test deployment.
 
No, because it isn't deployed. You can install to development computer to test deployment.

The problem i have is if i deploy the application im having results that i dont want i.e. it checks for updates when the published application is first run. When updates have been published the application is stating no updates.

What would be the best way to debug this? I thought of enabling JIT (under options menu) but it already is, i think i need more information to see whats happening any suggestions? Shame it cant be done via design mode.

Thank you for your help.
 
Back
Top