-2

I seek a solution for updating via internet a program I developed in "C# / .NET / WPF". This project contains subdirectories with different file types and also different libraries (dll).

So far I distributed my program in a .zip file containing all the files (800kb at all) as a portable solution.

I do not particularly need a setup, but I seek for a free upgrade solution.

  • I tried ClickOnce, but it is not possible to distribute the application in a "portable way" and the place where the application is installed does not suit me.

  • I watched WiX but there is there a function to notify and do the update by Internet?

  • Other solutions?

Ezequiel Jadib
  • 14,767
  • 2
  • 38
  • 43
pclashe
  • 1
  • 2
  • possible duplicate of [What's the best way for a .NET winforms application to update itself without using ClickOnce?](http://stackoverflow.com/questions/150994/whats-the-best-way-for-a-net-winforms-application-to-update-itself-without-usi) – Steven Rands Jan 20 '15 at 16:22

1 Answers1

0

Well i found something like that on msdn:

private void InstallUpdateSyncWithInfo()
{
    UpdateCheckInfo info = null;

    if (ApplicationDeployment.IsNetworkDeployed)
    {
        ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

        try
        {
            info = ad.CheckForDetailedUpdate();

        }
        catch (DeploymentDownloadException dde)
        {
            MessageBox.Show("The new version of the application cannot be downloaded at this time. \n\nPlease check your network connection, or try again later. Error: " + dde.Message);
            return;
        }
        catch (InvalidDeploymentException ide)
        {
            MessageBox.Show("Cannot check for a new version of the application. The ClickOnce deployment is corrupt. Please redeploy the application and try again. Error: " + ide.Message);
            return;
        }
        catch (InvalidOperationException ioe)
        {
            MessageBox.Show("This application cannot be updated. It is likely not a ClickOnce application. Error: " + ioe.Message);
            return;
        }

        if (info.UpdateAvailable)
        {
            Boolean doUpdate = true;

            if (!info.IsUpdateRequired)
            {
                DialogResult dr = MessageBox.Show("An update is available. Would you like to update the application now?", "Update Available", MessageBoxButtons.OKCancel);
                if (!(DialogResult.OK == dr))
                {
                    doUpdate = false;
                }
            }
            else
            {
                // Display a message that the app MUST reboot. Display the minimum required version.
                MessageBox.Show("This application has detected a mandatory update from your current " + 
                    "version to version " + info.MinimumRequiredVersion.ToString() + 
                    ". The application will now install the update and restart.", 
                    "Update Available", MessageBoxButtons.OK, 
                    MessageBoxIcon.Information);
            }

            if (doUpdate)
            {
                try
                {
                    ad.Update();
                    MessageBox.Show("The application has been upgraded, and will now restart.");
                    Application.Restart();
                }
                catch (DeploymentDownloadException dde)
                {
                    MessageBox.Show("Cannot install the latest version of the application. \n\nPlease check your network connection, or try again later. Error: " + dde);
                    return;
                }
            }
        }
    }
}

http://msdn.microsoft.com/en-us/library/ms404263.aspx

To specify alternate update source you can use MageUI

1.Open a .NET Framework command prompt and type: mageui.exe

2.On the File menu, choose Open to open your application's deployment manifest.

3.Select the Deployment Options tab.

4.In the text box named Launch Location, enter the URL to the directory that will contain the deployment manifest for application updates.

5.Save the deployment manifest.

windoo
  • 83
  • 1
  • 9
  • I have already seen this, but I can't distribute my application to "portable" version, and just want to have the clickOnce update system! There is always a setup, I don't want. I want to distribute to .zip. – pclashe Jan 20 '15 at 20:22
  • I want distribute my application to "portable" + AutoUpdate. – pclashe Jan 21 '15 at 07:50
  • I'll make my process to update myself, it is not very complicated. – pclashe Jan 21 '15 at 15:06