Question Problem with automatic update

Joined
Apr 29, 2008
Messages
12
Programming Experience
10+
I have developed a program for my company that monitors our salespeople while they are working. The program runs silently in the background and reports what web pages employees are browsing to into an sql database on our server. The problem is I have set up the program to programatically check for updates, but it doesn't seem to be working. I created a table in our database to track the updates, when a program is updated, it updates it's "profile" in this table with the new version number, so I can ensure all the updates are being applied. It is programmed to do this silently so that the employees are not interrupted.

here is my code:
VB.NET:
Dim info As UpdateCheckInfo = Nothing

            If (ApplicationDeployment.IsNetworkDeployed) Then
                Dim AD As ApplicationDeployment = ApplicationDeployment.CurrentDeployment

                Try
                    info = AD.CheckForDetailedUpdate()
                Catch dde As DeploymentDownloadException

                Catch ioe As InvalidOperationException

                End Try

                If info.UpdateAvailable = True Then

                    Try
                        AD.Update()
                        My.Settings.UpdateInstalled = True
                        Application.Restart()
                    Catch dde As DeploymentDownloadException

                    End Try

                End If

            End If

When I publish the program it is published to a unc path on our server, in the updates window the program is set to check this unc path for updates. As far as I know, i've followed all the instructions from the microsoft website verbatim. The funny thing is, we have another program that is used to read the database that I created with the exact same update schema. This program is installed on all of the manager's computers and it updates fine.
 
Well I don't know if this was the right thing to do but I removed some code and now it appears to be working on my test workstation.

I removed this part:
VB.NET:
If (ApplicationDeployment.IsNetworkDeployed) Then

so it tries to get updates regardless, not sure if that was the right thing because everywhere I go i'm told to use that code

I did however use try/catch blocks on all the updating code, and set up code where if there was an error to submit the details into a table for errors. So far the table shows no hits whatsoever so I guess i'll try to deploy these on the rest of the workstations

If anyone has any comments please let me know, if this code is shaky or unreliable I don't want to use it. It's very important that these programs run all the time and without error because we have a very serious internet abuse problem.
 
If anyone has any comments please let me know, if this code is shaky or unreliable I don't want to use it. It's very important that these programs run all the time and without error because we have a very serious internet abuse problem.

Any company that is that concerned about internet access should have a Firewall and would be using its built in monitoring instead if writing their own application that wouldn't monitor as much?

And if people are going to websites they should be going to, then block it with the Firewall.

CT
 
Our router doesn't have built in monitoring, either way we can't block sites at that level because it would not allow access to those who are authorized. The program I have created works perfectly and is custom tailored to what the board of directors wanted. It not only monitors/blocks but records statistics. Our salespeople heavily use the internet in dealing with our different clients and the program allows managers to classify sites and link them to customer's accounts. It has proven to be a great tool in sales coaching and allows management to do deep analysis of how a salesperson is using the programs on their workstation. The program also monitors and tracks programs that users are using and tells managers when and how long different programs are being used. We have one program called Goldmine, which we use to keep track of customer contact's and followups, another program for writing orders, etc. Management has been able to pinpoint salespeople that are losing sales simply because theyr'e statistics are well below or a lot different than other sales people.

Anyhow, last friday I pushed the new version out to all the workstations, I have a table in the database that contains all the usernames, machine names, lunch schedules, and current software version numbers. When a monitoring program runs on a workstation, it immediately reports it's version number to the database. I pushed the new version, then made a small change to the code and published an update. Literally within minutes I watched all the versions step up to the update that I put out. So it looks like it worked well. I don't know about the whole network deployed thing, if it only applies to programs that are downloaded from a url. Ours is published/updated/and downloaded from a unc path on our server.

Believe it or not, one of the main features the company wanted was for employees to have unlimited internet access during their lunch period. I told them that technically when it comes to business that feature wasn't important, and that most companies would simply say "their company computers, they're strictly for business purposes", but they wanted it so whenever someone's lunch starts, they can do whatever they want.
 
Now all of a sudden i'm getting this error:

Application identity is not set.

i'm getting it on the line where the program reports it's version number to the database. I didn't get the error initially when I installed it on the workstations, and even after I pushed an update still didn't get the error.

VB.NET:
_ProductVersion = My.Application.Deployment.CurrentVersion.ToString

I don't understand why at first it worked, now all of a sudden it's not working. I'm going to try to do an update to see if it takes it, my guess is it probably won't

Wow, now the programs are not updating again. How in the heck does this work, how does it work one day, and then not work the next? I've been deploying the app through a unc path, do I have to publish it to a website for this feature to work? And if so then why did it work initially?
 
And here's something interesting. I have this program running on my system as well (the development system) and although it will not update either, it does successfully report the version number to me.
 
I may have an idea of what the probalem might be. My program is set to automatically create a registry key under the current user to autorun the program on startup. It seems that when the program is installed initially, and then I publish an update it updates fine. Then when the computer is restarted and it runs from the registry, it seems to "lose it's identity" or something. Not sure why this would happen but i'm going to reinstall it and try starting it manually to see if I have the same problem

That's the problem, I don't know why but when the program is started up directly from the executable, it messes up the update process. After installing a new build I ran the installer, which installed the program and automatically started it (which clickonce installer normally does). I did 2 software updates which installed like clockwork. When I shut the program down and started it from the executable itself, the error came back. This is the strangest behavior I have ever seen, I guess I have a limited knowledge of how clickonce deployment works because I feel this makes no sense.

Does anyone have any idea how I can get around this?
 
Answer Found!

In case anyone is interested, I found why this problem has been existing with this program. When your app installs a special shortcut called an application reference is added to the start menu. This special shortcut is the file that contains special data that is needed for the update process. The method I was using for autorunning my program on startup was to place a registry key pointing towards the executable, hence skipping the application reference. So I redesigned my code to first move this file from the start menu to the app folder itself (did this since we don't want anyone seeing the program in the start menu). Then adding the path to the application reference (projectname.appref-ms). When the system logs on, the registry points towards the application reference, which in turn populates all the data needed for updating and runs the program. I have restarted many times and installed many updates and they are all working perfectly.

So in the future, it seems that loading a .net app from the executable itself is a bad practice.:):)
 
Back
Top