title: ClickOnce - error when updating after deployment
body: <p>I have a WPF application that is deployed using ClickOnce (the app is deployed to a network drive which all clients can access) , and I have a timer in the app that fires every 10 minutes and checks for updates, and automatically installs them if there are. My updating class is as below:</p>
  
  <pre><code>public class AppUpdater
  {
      public bool CheckForUpdates()
      {
          ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
          return ad.CheckForUpdate();
  
      }
  
      public void PerformUpdate()
      {
  
          ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
          UpdateCheckInfo updateInfo = ad.CheckForDetailedUpdate();
  
          if (updateInfo.UpdateAvailable)
          {
              MessageBox.Show("There is an update available. Press OK to continue");
              ad.Update();
              MessageBox.Show("Application updated! Press OK to restart");
              System.Windows.Forms.Application.Restart();
              Application.Current.Shutdown();
          }
  
      }
  }
  </code></pre>
  
  <p>When testing on the network my development machine is on, this works fine - a few colleagues of mine have tried running the app and they can always get the latest update. However when deployed on our customers server, the app crashes when trying to update from the timer. The excpetion we get is below:</p>
  
  <blockquote>
    <p>at System.Deployment.Application.ApplicationTrust.RequestTrust(SubscriptionState subState, Boolean isShellVisible, Boolean isUpdate, ActivationContext actCtx, TrustManagerContext tmc)
       at System.Deployment.Application.DeploymentManager.DetermineTrustCore(Boolean blocking, TrustParams tp)
       at System.Deployment.Application.DeploymentManager.DetermineTrust(TrustParams trustParams)
       at System.Deployment.Application.ApplicationDeployment.CheckForDetailedUpdate(Boolean persistUpdateCheckResult)
       at System.Deployment.Application.ApplicationDeployment.CheckForUpdate()
       at TestApp.AppUpdater.CheckForUpdates()
       at TestApp.MainWindow.versionTimer_Tick(Object sender, EventArgs e)
       at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)</p>
  </blockquote>
  
  <p>But interestingly works fine if you reopen the app (it prompts you to download the latest version, then downloads it and runs it as expected). </p>
  
  <p>Any ideas? Thanks!</p>