title: "the manifest may not be valid or the file could not be opened" error when using .NET click once installation
body: <p>We recently updated our .NET application (C# containing infragistics controls, Visual Studio 2010, Click Once deployment) from .NET 2.0 runtime to .NET 4.0 runtime. To do so, we updated all our project properties from 2.0 to 4.0 full, so not client profile. We also changed the corresponding prerequisites from 2.0 to 4.0. Now we are facing some problems while rolling out our application to the clients.</p>
  
  <p>We have 2 ways to install the application:
  1) By using the URL of the deploy server: No problem here.
  2) By using the current application shortcut - which most of the users do. This option gives the problem.</p>
  
  <p>During the first installation run, the installation fails. Below is an extract of the clickonce log. Weird thing is that there are 2.0 references in the platform version info, although, the .NET 4.0 runtime is already pre-installed at the point of installation. Don't know if this has something to do with the problem. Second strange thing is the error: "Exception occurred loading manifest from file Progress.Messages.dll: the manifest may not be valid or the file could not be opened.". Maybe not unimportant, but this DLL is signed.</p>
  
  <pre><code>PLATFORM VERSION INFO
  Windows             : 5.1.2600.196608 (Win32NT)
  Common Language Runtime     : 2.0.50727.3649
  System.Deployment.dll       : 2.0.50727.3053 (netfxsp.050727-3000)
  mscorwks.dll            : 2.0.50727.3649 (GDR.050727-3600)
  dfshim.dll          : 4.0.31106.0 (Main.031106-0000)
  
  ....
  
  ERROR DETAILS
  Following errors were detected during this operation.
  * [10/12/2013 15:22:11] System.Deployment.Application.InvalidDeploymentException (ManifestLoad)
      - Exception occurred loading manifest from file Progress.Messages.dll: the manifest may not be valid or the file could not be opened. 
      - Source: System.Deployment
      - Stack trace:
          at System.Deployment.Application.Manifest.AssemblyManifest.ManifestLoadExceptionHelper(Exception exception, String filePath)
          at System.Deployment.Application.Manifest.AssemblyManifest.LoadFromInternalManifestFile(String filePath)
          at System.Deployment.Application.Manifest.AssemblyManifest..ctor(String filePath)
          at System.Deployment.Application.DownloadManager.ProcessDownloadedFile(Object sender, DownloadEventArgs e)
          at System.Deployment.Application.FileDownloader.DownloadModifiedEventHandler.Invoke(Object sender, DownloadEventArgs e)
          at System.Deployment.Application.FileDownloader.OnModified()
          at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
          at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
          at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
          at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
          at System.Deployment.Application.DeploymentManager.SynchronizeCore(Boolean blocking)
      --- Inner Exception ---
      System.Deployment.Application.DeploymentException (InvalidManifest)
      - Cannot load internal manifest from component file.
      - Source: 
      - Stack trace:
  </code></pre>
  
  <p>The second time, the installation is executed on the same client machine, the installation is succesfull. Below is again an extract of the clickonce log at that point.</p>
  
  <pre><code>PLATFORM VERSION INFO
  Windows             : 5.1.2600.196608 (Win32NT)
  Common Language Runtime     : 4.0.30319.1008
  System.Deployment.dll       : 4.0.30319.1 (RTMRel.030319-0100)
  clr.dll             : 4.0.30319.1008 (RTMGDR.030319-1000)
  dfdll.dll           : 4.0.30319.1 (RTMRel.030319-0100)
  dfshim.dll          : 4.0.31106.0 (Main.031106-0000)
  
  ....
  </code></pre>
  
  <p>We are trying to find a solution to this problem for days, without result... Any answers or pushes in the right direction are welcome!</p>
  
  <p>Thanks in advance!</p>