Windows > Windows Forms Forums > ClickOnce and Setup & Deployment Projects > Auto update optin in windows form project
Ask a questionAsk a question
 

AnswerAuto update optin in windows form project

  • Tuesday, October 06, 2009 9:25 AMMuhilan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,
    We are deploying a application using vb.net and windows form. This application will be deployed in various factories of customer. Each factory has its own local server. Curretnly we are using app.config file to specify connection string of sqlserver 2008 database.

    We want to deploy this application such way that whenever new updates comes, the application need to update it automatically without user intervention.

    We can use Click Once for auto update facility. But we need to change the app.config file to specify database name and also we need to read some files from the local computer also like importing from excel, reading data from a access file. Till date there is no registry reading and writting from our application.

    Is there way to do it by click once?  Shall I run click once in full trust mode in local PC?

    I read some of the sites. They are explaing that puting the enteir application exe and its required assemblys in server and call a html from server IIS to execute this exe. While executing this, the exe will auto downloaded  in the client location and replace the old one provided .NET framewrok need to be install at client PC.

    I want to know the best possible solution to over come the difficulitis of auto update.


    Muhilan

Answers

  • Tuesday, October 06, 2009 9:09 PMRobinDotNetMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi Muhilan,

    ClickOnce deployment allows you to deploy a version of your application, and when you deploy a new version, the users will get the update automatically. For some general information on ClickOnce, check out these links:

    ClickOnce Overview
    http://msdn2.microsoft.com/en-us/library/142dbbz4(VS.80).aspx   

    HowTo publish a clickonce app   
    http://msdn2.microsoft.com/en-us/library/31kztyey(VS.80).aspx   

    When a new version is installed, it creates all new folders and puts the files there.

    I always deploy ClickOnce apps as full trust, but that's a decision you'll have to make. It does give you access to the user's file system under his profile, such as MyDocuments. ClickOnce installs in the user's profile, and to access anythihng from, say, Program Files, requires elevated privileges with Windows Vista and Windows Fabulous (7).

    You can change the app.config file when you release each version and it will update it on the client side.

    You can also store files in LocalApplicationData in Vista and Windows Fabulous, and in fact it is the recommended place if you want to create some kind of cache for your application.

    For us, there are some files we want to put on the user's machine and still be located by our app when a ClickOnce update goes out. We create a folder in LocalApplicationData and cache a bunch of files and settings there. If there are files you are deploying that you want the user to be able to update and then not get lost by a ClickOnce update, you could do something similar, creating or updating the LocalApplicationData the first time the user runs the application, and then not when there is an update. This should give you the idea of what we're doing, and it's working great for us:

    http://robindotnet.wordpress.com/2009/08/19/where-do-i-put-my-data-to-keep-it-safe-from-clickonce-updates/

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev

All Replies

  • Tuesday, October 06, 2009 9:09 PMRobinDotNetMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi Muhilan,

    ClickOnce deployment allows you to deploy a version of your application, and when you deploy a new version, the users will get the update automatically. For some general information on ClickOnce, check out these links:

    ClickOnce Overview
    http://msdn2.microsoft.com/en-us/library/142dbbz4(VS.80).aspx   

    HowTo publish a clickonce app   
    http://msdn2.microsoft.com/en-us/library/31kztyey(VS.80).aspx   

    When a new version is installed, it creates all new folders and puts the files there.

    I always deploy ClickOnce apps as full trust, but that's a decision you'll have to make. It does give you access to the user's file system under his profile, such as MyDocuments. ClickOnce installs in the user's profile, and to access anythihng from, say, Program Files, requires elevated privileges with Windows Vista and Windows Fabulous (7).

    You can change the app.config file when you release each version and it will update it on the client side.

    You can also store files in LocalApplicationData in Vista and Windows Fabulous, and in fact it is the recommended place if you want to create some kind of cache for your application.

    For us, there are some files we want to put on the user's machine and still be located by our app when a ClickOnce update goes out. We create a folder in LocalApplicationData and cache a bunch of files and settings there. If there are files you are deploying that you want the user to be able to update and then not get lost by a ClickOnce update, you could do something similar, creating or updating the LocalApplicationData the first time the user runs the application, and then not when there is an update. This should give you the idea of what we're doing, and it's working great for us:

    http://robindotnet.wordpress.com/2009/08/19/where-do-i-put-my-data-to-keep-it-safe-from-clickonce-updates/

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
  • Friday, October 09, 2009 7:27 AMMuhilan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi
    Thanks for reply.

    My main issue is connection string of sqlserver database. Each factory has its own connection string. We need to deploy the application in more than 2 factory at a time.

    It is not possible for us to build factory wise deployment.

    Currently we are using app.config file to define connection string.

    If it one factory we can change the app.config file and deploy it over thc PC of factory.

    But how can I change connection string in app.config after building setup of clickonce?

    It is not possible to change connection after deployment and also in the time of deployment.

    Let me know is it possible?

    Muhilan
  • Wednesday, November 04, 2009 12:41 PMPraveen.Reghunath Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Click once need user intervention. We have implemented a similar solution. We created a windows application that always runs in the client computer and checks a web service to get updates. Once it available download the Updater.exe and runs it in client side. The Updater.exe is a c# application intelligent enough to backup existing files and config then uninstall existing application install new version and then set the configurations back.

  • Friday, November 13, 2009 10:29 PMRobinDotNetMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You could prompt the user for the information, and store it in the user settings. Not for the connection string, but for the location of hte database or whatever it is that you need in your connection string.

    Is there *anything* in your application that tells you who has it installed? THat's another thing you could do -- prompt the user, then use that to set the appropriate connection string, and store it so you never have to ask him again.

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev