【问题标题】:C# WinForms - App Installation Error - Reference in the manifest does not match the identity of the downloaded assemblyC# WinForms - 应用程序安装错误 - 清单中的引用与下载的程序集的标识不匹配
【发布时间】:2011-07-30 20:41:50
【问题描述】:

背景:我有一个用 C# 编写的 winforms 应用程序,它通过从命令行调用第二个完全独立的应用程序 ConvertExcelTo.Exe 将 xlsx 文件转换为 csv。

错误摘要:

   Application validation did not succeed. Unable to continue.
   - Reference in the manifest does not match the identity of the downloaded assembly
     ConvertExcelTo.exe.    
   - Source: System.Deployment
  • 如何/在哪里编辑 Manifest 和 References 部分?
  • 我必须进行哪些更改才能正确安装而不会出现任何错误??

在引用下,ConvertExcelTo 我有:Assembly ConvertExcelTo - C:\Users\bmccarthy\Documents\Visual Studio 2008\Projects\CCP Utility 3-31-11\CCP Utility\bin\Debug\ConvertExcelTo.exe

在引用下,ConvertExcelTo.vshost 我有:{} Microsoft.VisualStudio.HostingProcess、EntryPoint、基本类型、对象:~Object()、Equals(object, object)、Equals(object)、GetHashCode()、GetType( )、MemberwiseClone()、Object()、ReferenceEquals(object, object)、ToString()。

完整的错误详情:

      WARNINGS
* The manifest for this application does not have a signature. Signature validation 
      will be ignored.
* The manifest for this application does not have a signature. Signature validation 
      will be ignored.

      ERROR DETAILS
Following errors were detected during this operation.
* [4/6/2011] System.Deployment.Application.InvalidDeploymentException(RefDefValidation)
    - Reference in the manifest does not match the identity of the downloaded assembly 
      ConvertExcelTo.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.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.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)

这是我调用 ConvertExcelTo.exe 应用程序的 MainForm.cs 中的代码:

            //Process that creates all the xlsx files in temp folder to csv files.
            Process convertFilesProcess = new Process();

            // command prompt execution for Converting Files from XLSX to CSV 
            //convertFilesProcess.StartInfo.WorkingDirectory = ConfigurationSettings.AppSettings["WorkingDirectory"].ToString();
            convertFilesProcess.StartInfo.FileName = "ConvertExcelTo.exe";
            convertFilesProcess.StartInfo.Arguments = " " + tempfolder + "\\ " + "csv";
            convertFilesProcess.StartInfo.UseShellExecute = false;
            convertFilesProcess.StartInfo.CreateNoWindow = true;
            convertFilesProcess.StartInfo.RedirectStandardInput = true;
            convertFilesProcess.StartInfo.RedirectStandardOutput = true;
            convertFilesProcess.StartInfo.RedirectStandardError = true;
            convertFilesProcess.Start();
            convertFilesProcess.WaitForExit();

            StreamReader sOut = convertFilesProcess.StandardOutput;
            StreamReader sErr = convertFilesProcess.StandardError;
            sOut.Close();
            sErr.Close();

感谢收看!

【问题讨论】:

  • 查看为您的部署生成的清单。它们可能是应用程序名称的差异???在 ErrorSummary 中,有这一行“清单中的引用与下载的程序集 ConvertExcelTo.exe 的标识不匹配。”
  • @jonnyItunes,感谢您的回复。我编辑了我的问题,让您更好地了解问题。此应用程序从命令行调用第二个完全独立的应用程序 ConvertExcelTo.Exe。我在哪里可以编辑清单或引用?我不认为 ConvertExcelTo 作为外部应用程序需要参考,对吧?
  • 见下面的答案。希望对您有所帮助。

标签: c# winforms error-handling failed-installation


【解决方案1】:

通过从命令行调用第二个完全独立的应用程序 ConvertExcelTo.Exe

这不是你在做的,你实际上是在尝试加载那个 EXE 程序集。两次,一次通过可执行文件的 Visual Studio 托管进程版本,仅在您调试 EXE 时相关。再次通过常规 EXE。这在 .NET 中有点奇怪,这甚至是可能的,在非常特定的情况下会派上用场。不在这里,CLR 对此大发雷霆。

删除您添加的程序集引用。使用 Process 类来启动这个程序。

【讨论】:

  • 我删除了对 ConvertExcelTo.exe 的引用,即使我正在经历流程方法,应用程序现在也无法运行...您建议我做什么?
  • 叹息,“它不起作用”我该怎么办?使用调试器。设置您通常使用 Project + Properties、Debug 选项卡传递的命令行选项。
  • 对不起,我的意思是 ConvertExcelTo 的命令行执行失败。
  • “它失败了”。这怎么比“它不起作用”更好?顺便说一句,请记录异常。
  • 哈哈对不起。我将现有项目 ConvertExcelTo.exe、ConvertExcelTo.vshost.exe、ExcelConversion.dll 添加到项目解决方案并删除了引用,现在它可以工作了。 :) 谢谢
【解决方案2】:

感谢您的澄清。看看这个页面here。这将引导您完成如何编辑部署清单。您应该将 ConvertExcelTo.exe 安装为另一个应用程序。您可以通过清单将其添加为安装过程的先决条件,并将其引导至安装。有关引导 here 的一些信息。它适用于 VS 2005,但我认为流程没有改变。 Bootstrap Manifest Generator 应用程序是 here。只需单击“下载”选项卡。希望对您有所帮助。

【讨论】:

  • @JohnnyItunes,我删除了对 ConvertExcelTo.exe 的引用,即使我正在经历流程方法,该应用程序现在也无法工作......你建议我怎么做才能安装它正确并且仍然有效?
  • @JohnnyItunes,如果我通过 Bootstrap Manifest Generator 应用程序添加文件,我可以保留参考吗?
猜你喜欢
  • 2019-10-30
  • 2011-07-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-06-10
相关资源
最近更新 更多