次の方法で共有


Reference in the manifest does not match the identity of the downloaded assembly

You may find the below error message while launching a ClickOnce application: “Reference in the manifest does not match the identity of the downloaded assembly MyApp.exe.”

Log snippet:

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of \\MyServer\MyApp.application resulted in exception. Following failure messages were detected:
  + Reference in the manifest does not match the identity of the downloaded assembly WinApp.exe.

Following errors were detected during this operation.
* [28-Feb-12 10:53:06 AM]

System.Deployment.Application.InvalidDeploymentException (RefDefValidation)
  - Reference in the manifest does not match the identity of the downloaded assembly WinApp.exe.
  - Source: System.Deployment

Stack trace:
   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.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.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
   at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
   at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
   at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

 

After investigating this issue, I found that this issue occurs due to a manifest being embedded into the executable while building the application. On Visual Studio 2008 onwards, by default it embeds manifest information into assemblies. Hence, the resolution is to include /nowin32manifest switch https://msdn.microsoft.com/en-us/library/bb513864.aspx  while building your application. Another approach would be to exclude the embedded manifest file after building the application. In order to do that please open Visual Studio IDE and Open the executable file from the menu (File—>Open—>File). You will find the below screenshot:

manifest

 

Now delete RT_MANIFEST and save the executable file.