6

i used ClickOnce publish to deploy my WPF applicaiton

when i try to update manually

the ApplicationDeployment.IsNetworkDeployed is always return false so it doesnt check for the updated. it cant able to find the currentdeployment settings

am using the below method to update manually http://msdn.microsoft.com/en-us/library/ms404263.aspx

Spen D
  • 4,225
  • 9
  • 39
  • 47

1 Answers1

6

IsNetworkDeployed will only be true if the application is launched from its deployment url (.xbap). The only reason IsNetworkDeployed would return false in a deployed application is if accessing ApplicationDeployment.CurrentDeployment throws an exception....

So to more deeply investigate your problem, you should be able to do something like this:

 try
 {
      string foo = ApplicationDeployment.CurrentDeployment.DataDirectory;
 }
 catch (Exception e)
 {
      MessageBox.Show("Exception: " + e.Message + "\n" + e.StackTrace);
 }
  • it throws some exception {System.Deployment.Application.InvalidDeploymentException: Application identity does not match the application already installed. at System.Deployment.Application.ApplicationDeployment..ctor(String fullAppId) at System.Deployment.Application.ApplicationDeployment.get_CurrentDeployment() – Spen D Mar 18 '12 at 07:59
  • 2
    Found more comprehensive answer [here](http://social.msdn.microsoft.com/Forums/ru-RU/wpf/thread/f1ec20c8-9225-4e5d-903a-434e33aff349) – Maksim Tyutmanov May 15 '12 at 09:50
  • If you don't like the exception handling strategy, you could test whether `AppDomain.CurrentDomain.BaseDirectory` contains ``\AppData\`` – Kind Contributor Oct 27 '16 at 03:34