title: ClickOnce deployment auto update is not working
body: <p>I am using <a href="http://en.wikipedia.org/wiki/ClickOnce" rel="nofollow">ClickOnce</a> deployment to check for updates:</p>
  
  <ol>
  <li>I have done the settings like in the publish tab, publish URL, and check for updates path, and check for updates before application starts and run application both offline and online.</li>
  <li>I am getting updates if install the application from local system but, if I install the application from server then it is not checking for updates.</li>
  </ol>
  
  <p>Below is the code that I have used for checking updates. How do I rectify this problem?</p>
  
  <pre><code>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;
                  }
              }
          }
      }
      else
      {
          MessageBox.Show("There are no updates available");
      }
  }
  </code></pre>
  
  <p><strong>C# project text file:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Project ToolsVersion="4.0" DefaultTargets="Build"
      xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
      &lt;PropertyGroup&gt;
          &lt;Configuration Condition=" '$(Configuration)' == '' "&gt;Debug&lt;/Configuration&gt;
          &lt;Platform Condition=" '$(Platform)' == '' "&gt;x86&lt;/Platform&gt;
          &lt;ProductVersion&gt;8.0.30703&lt;/ProductVersion&gt;
          &lt;SchemaVersion&gt;2.0&lt;/SchemaVersion&gt;
          &lt;ProjectGuid&gt;{1804771A-88C8-49AD-9763-44A296B7EC2B}&lt;/ProjectGuid&gt;
          &lt;OutputType&gt;WinExe&lt;/OutputType&gt;
          &lt;AppDesignerFolder&gt;Properties&lt;/AppDesignerFolder&gt;
          &lt;RootNamespace&gt;TestUpdate&lt;/RootNamespace&gt;
          &lt;AssemblyName&gt;TestUpdate&lt;/AssemblyName&gt;
          &lt;TargetFrameworkVersion&gt;v3.5&lt;/TargetFrameworkVersion&gt;
          &lt;TargetFrameworkProfile&gt;Client&lt;/TargetFrameworkProfile&gt;
          &lt;FileAlignment&gt;512&lt;/FileAlignment&gt;
          &lt;IsWebBootstrapper&gt;true&lt;/IsWebBootstrapper&gt;
          &lt;PublishUrl&gt;C:\Program Files %28x86%29\Zend\Apache2\htdocs\TestUpdate\&lt;/PublishUrl&gt;
          &lt;Install&gt;true&lt;/Install&gt;
          &lt;InstallFrom&gt;Web&lt;/InstallFrom&gt;
          &lt;UpdateEnabled&gt;true&lt;/UpdateEnabled&gt;
          &lt;UpdateMode&gt;Foreground&lt;/UpdateMode&gt;
          &lt;UpdateInterval&gt;7&lt;/UpdateInterval&gt;
          &lt;UpdateIntervalUnits&gt;Days&lt;/UpdateIntervalUnits&gt;
          &lt;UpdatePeriodically&gt;false&lt;/UpdatePeriodically&gt;
          &lt;UpdateRequired&gt;true&lt;/UpdateRequired&gt;
          &lt;MapFileExtensions&gt;true&lt;/MapFileExtensions&gt;
          &lt;InstallUrl&gt;http://www.acharis.com/Clinic/TestUpdate/&lt;/InstallUrl&gt;
          &lt;UpdateUrl&gt;http://www.acharis.com/Clinic/TestUpdate/&lt;/UpdateUrl&gt;
          &lt;ProductName&gt;Test UPdate&lt;/ProductName&gt;
          &lt;PublisherName&gt;Acharis&lt;/PublisherName&gt;
          &lt;SuiteName&gt;www.acharis.com&lt;/SuiteName&gt;
          &lt;MinimumRequiredVersion&gt;1.0.0.10&lt;/MinimumRequiredVersion&gt;
          &lt;CreateWebPageOnPublish&gt;true&lt;/CreateWebPageOnPublish&gt;
          &lt;WebPage&gt;test.html&lt;/WebPage&gt;
          &lt;ApplicationRevision&gt;11&lt;/ApplicationRevision&gt;
          &lt;ApplicationVersion&gt;1.0.0.%2a&lt;/ApplicationVersion&gt;
          &lt;UseApplicationTrust&gt;true&lt;/UseApplicationTrust&gt;
          &lt;CreateDesktopShortcut&gt;true&lt;/CreateDesktopShortcut&gt;
          &lt;PublishWizardCompleted&gt;true&lt;/PublishWizardCompleted&gt;
          &lt;BootstrapperEnabled&gt;true&lt;/BootstrapperEnabled&gt;
      &lt;/PropertyGroup&gt;
  
      &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "&gt;
          &lt;PlatformTarget&gt;x86&lt;/PlatformTarget&gt;
          &lt;DebugSymbols&gt;true&lt;/DebugSymbols&gt;
          &lt;DebugType&gt;full&lt;/DebugType&gt;
          &lt;Optimize&gt;false&lt;/Optimize&gt;
          &lt;OutputPath&gt;bin\Debug\&lt;/OutputPath&gt;
          &lt;DefineConstants&gt;DEBUG;TRACE&lt;/DefineConstants&gt;
          &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
          &lt;WarningLevel&gt;4&lt;/WarningLevel&gt;
      &lt;/PropertyGroup&gt;
      &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "&gt;
          &lt;PlatformTarget&gt;x86&lt;/PlatformTarget&gt;
          &lt;DebugType&gt;pdbonly&lt;/DebugType&gt;
          &lt;Optimize&gt;true&lt;/Optimize&gt;
          &lt;OutputPath&gt;bin\Release\&lt;/OutputPath&gt;
          &lt;DefineConstants&gt;TRACE&lt;/DefineConstants&gt;
          &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
          &lt;WarningLevel&gt;4&lt;/WarningLevel&gt;
      &lt;/PropertyGroup&gt;
      &lt;PropertyGroup&gt;
          &lt;ManifestCertificateThumbprint&gt;B3D4C4433FA2AC368ACF13B0917D1CFEADFDF92A
          &lt;/ManifestCertificateThumbprint&gt;
      &lt;/PropertyGroup&gt;
      &lt;PropertyGroup&gt;
          &lt;ManifestKeyFile&gt;TestUpdate_TemporaryKey.pfx&lt;/ManifestKeyFile&gt;
      &lt;/PropertyGroup&gt;
      &lt;PropertyGroup&gt;
          &lt;GenerateManifests&gt;true&lt;/GenerateManifests&gt;
      &lt;/PropertyGroup&gt;
      &lt;PropertyGroup&gt;
          &lt;SignManifests&gt;true&lt;/SignManifests&gt;
      &lt;/PropertyGroup&gt;
      &lt;ItemGroup&gt;
         &lt;Reference Include="System" /&gt;
         &lt;Reference Include="System.Core" /&gt;
         &lt;Reference Include="System.Xml.Linq" /&gt;
         &lt;Reference Include="System.Data.DataSetExtensions" /&gt;
         &lt;Reference Include="Microsoft.CSharp" /&gt;
         &lt;Reference Include="System.Data" /&gt;
         &lt;Reference Include="System.Deployment" /&gt;
         &lt;Reference Include="System.Drawing" /&gt;
         &lt;Reference Include="System.Windows.Forms" /&gt;
         &lt;Reference Include="System.Xml" /&gt;
      &lt;/ItemGroup&gt;
      &lt;ItemGroup&gt;
          &lt;Compile Include="Form1.cs"&gt;
              &lt;SubType&gt;Form&lt;/SubType&gt;
          &lt;/Compile&gt;
          &lt;Compile Include="Form1.Designer.cs"&gt;
              &lt;DependentUpon&gt;Form1.cs&lt;/DependentUpon&gt;
          &lt;/Compile&gt;
          &lt;Compile Include="Program.cs" /&gt;
          &lt;Compile Include="Properties\AssemblyInfo.cs" /&gt;
          &lt;EmbeddedResource Include="Form1.resx"&gt;
              &lt;DependentUpon&gt;Form1.cs&lt;/DependentUpon&gt;
          &lt;/EmbeddedResource&gt;
          &lt;EmbeddedResource Include="Properties\Resources.resx"&gt;
              &lt;Generator&gt;ResXFileCodeGenerator&lt;/Generator&gt;
              &lt;LastGenOutput&gt;Resources.Designer.cs&lt;/LastGenOutput&gt;
              &lt;SubType&gt;Designer&lt;/SubType&gt;
          &lt;/EmbeddedResource&gt;
          &lt;Compile Include="Properties\Resources.Designer.cs"&gt;
              &lt;AutoGen&gt;True&lt;/AutoGen&gt;
              &lt;DependentUpon&gt;Resources.resx&lt;/DependentUpon&gt;
              &lt;DesignTime&gt;True&lt;/DesignTime&gt;
          &lt;/Compile&gt;
          &lt;None Include="app.config" /&gt;
          &lt;None Include="Properties\Settings.settings"&gt;
              &lt;Generator&gt;SettingsSingleFileGenerator&lt;/Generator&gt;
              &lt;LastGenOutput&gt;Settings.Designer.cs&lt;/LastGenOutput&gt;
          &lt;/None&gt;
          &lt;Compile Include="Properties\Settings.Designer.cs"&gt;
              &lt;AutoGen&gt;True&lt;/AutoGen&gt;
              &lt;DependentUpon&gt;Settings.settings&lt;/DependentUpon&gt;
              &lt;DesignTimeSharedInput&gt;True&lt;/DesignTimeSharedInput&gt;
          &lt;/Compile&gt;
          &lt;None Include="TestUpdate_TemporaryKey.pfx" /&gt;
      &lt;/ItemGroup&gt;
      &lt;ItemGroup&gt;
          &lt;BootstrapperPackage Include="Microsoft.Net.Client.3.5"&gt;
              &lt;Visible&gt;False&lt;/Visible&gt;
              &lt;ProductName&gt;.NET Framework 3.5 SP1 Client Profile&lt;/ProductName&gt;
              &lt;Install&gt;true&lt;/Install&gt;
          &lt;/BootstrapperPackage&gt;
          &lt;BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"&gt;
              &lt;Visible&gt;False&lt;/Visible&gt;
              &lt;ProductName&gt;.NET Framework 3.5 SP1&lt;/ProductName&gt;
              &lt;Install&gt;false&lt;/Install&gt;
          &lt;/BootstrapperPackage&gt;
          &lt;BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"&gt;
              &lt;Visible&gt;False&lt;/Visible&gt;
              &lt;ProductName&gt;Windows Installer 3.1&lt;/ProductName&gt;
              &lt;Install&gt;true&lt;/Install&gt;
          &lt;/BootstrapperPackage&gt;
      &lt;/ItemGroup&gt;
      &lt;Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /&gt;
      &lt;!-- To modify your build process, add your task inside one of the targets below and
         Other similar extension points exist, see Microsoft.Common.targets.
      &lt;Target Name="BeforeBuild"&gt;
      &lt;/Target&gt;
      &lt;Target Name="AfterBuild"&gt;
      &lt;/Target&gt;
      --&gt;
  &lt;/Project&gt;
  </code></pre>