Visual Basic 2008 how to autoupdate my application at startup.

Posted on 2009-04-29
Last Modified: 2013-11-26
Is there a way to Autoupdate an application when it start without using the publishing wizard ?

I want my program to reside in program files dir not some strange encrypted dir because I start other projects from wihtin one project.

Is there a way to run or call an autoupdate by code ?
Question by:siacom
    LVL 13

    Expert Comment

    Just a simple question first : I didn't understand why you don't want to use the publish tool of VS.
    According to the screenshots bellow you're not obliged to deploy into some "some strange encrypted dir" !
    Think also that you can use the Update Option, but I think you knew it already.

    I think you should dig on the existing tools instead of trying to reinvent the wheel if possible. So let's try to discover what you assume is not possible without coding.

    BTW, don't you need a setup project ?

    Author Comment

    Well I was not refering to the location of the installation files I was refering to the location of the FINAL installed application.

    If you are extremely lucky to find your precious installed apllication you'll problably find that it has installed it in C:\Users\ME\AppData\Local\Apps\2.0\XM4QGLJJ.WBD\M9HBKMXB.X4Z
    for example ....  

    and I need to refer to another project which I call claims plus others.
    now when I publish my WORKING application it will not find claims or any other projects for that matter.

    the code below is an example of how i refer to projects all having the same "suite" name but different product names, hence they all reside in the same "suite" directory and can be refered to easily with the \..\  ...
    works fine if I create a setup project and run it.. however after setup has finished it will not check for updates :(

    Dim PathName As String = My.Application.Info.DirectoryPath
    PathName += "\..\claims\claims.exe"

    Open in new window

    LVL 13

    Expert Comment

    You didn't answer concerning the "Application Update" dialog that I forwarded. You only speak about publishing the application.
    It seems you think that this option is not impacting your project if you don't use the publish wizard. I think that you're wrong :

    Nevertheless, if it still doesn't match your requirements or if I misunderstood this setting, then if you want to do it programmatically, an possibility would be to dig around the use of the System.Deployment.Application.UpdateCheckInfo class and the System.Deployment.Application.ApplicationDeployment class:
    LVL 48

    Expert Comment

    ClickOnce is the easy and best method for automatic updates. You have some limitations, that's right, but you have allot of advantages.
    If you want to install your application in the Program Files, you can create a Setup Project and use another update method. You can find some easy examples like this:
    (and you have more there)

    Author Comment

    ic.. looking at the example I would much prefer to just use the publishing wuzard.

    So to get this right there is absolutely no way of finding out where the application will be installed in and no way of assigning a folder name ?

    at the moment publishing wizard installs the app in:

    and if I want to run another project there is no way of finding out where that other project will be installed after using the publishing wizard ?

    having a look at the examples, at this stage it would be a lot easier for me to create one text file with update=true ;-) and then run setup.exe

    LVL 48

    Accepted Solution

    To clarify: you what to run what application ?
    Remember the clickonce deployment will autostart the application an you can use the form load event to do what you need.

    Author Comment

    Well basically due to the size and design of this application I have split it into 3 different projects connected to the same sql database. They have been split because they are too different to use classes and objects and i would need to instatiate too many objects (very messy).

    SO... The first application is the login program that checks your network login name against the users table and your group name. depending on your group name it will load the application designed for that group.

    say the publisher is MyCompany and the Suite is CompleteApp then each project would reside in "Product Name" using a setup project would look like:

    As you can see Dim PathName As String = My.Application.Info.DirectoryPath will find out where login resides and therefore:
     >>    PathName += "\..\App2\App2.exe"  <<
    will run if they belong to group 2.

    This works great, but if I use publishing, then I cannot set a main folder for all compiled projects wihtin the solution.

    Mostly only one of the project will be updated at any time.

    when I looked at the ClikOnce application API there is a bit of work building the manifest with mage.exe and a lot more prep work then the Publishing wizard, since I limited with the amount of time to release version one, I don't have time to make this work prefectly yet.


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now