C# WinForms - 应用安装错误 - 清单中的引用与下载的程序集的标识不匹配

本文关键字:引用 下载 标识 不匹配 程序集 单中 应用 WinForms 安装 错误 | 更新日期: 2023-09-27 17:48:54

>背景:我有一个用 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
  • 如何/在哪里编辑清单和引用部分?
  • 我必须更改什么才能正确安装而没有任何错误?

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

在 References 下,ConvertExcelTo.vshost 我有:{} Microsoft.VisualStudio.HostingProcess、EntryPoint、Base Types、Objects: ~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)

下面是 MainForm 中的代码.cs我在其中调用 ConvertExcelTo.exe 应用程序:

            //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();

感谢您的观看!

C# WinForms - 应用安装错误 - 清单中的引用与下载的程序集的标识不匹配

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

这不是您正在执行的操作,您实际上是在尝试加载该 EXE 程序集。 两次,一次通过可视化工作室托管进程版本的可执行文件,仅在调试 EXE 时相关。 再次通过常规 EXE。 在.NET中,这甚至是一个怪癖,这甚至是可能的,在非常特殊的情况下会派上用场。 不在这里,CLR 对此发出嘶嘶声。

删除添加的程序集引用。 使用 Process 类启动此程序。

感谢您的澄清。请在此处查看此页面。这将逐步介绍如何编辑部署清单。您应该将ConvertExcelTo.exe安装为另一个应用程序。您可以通过清单将其添加为安装过程的先决条件,并将其引导到安装中。有关引导的一些信息,请点击此处。这是针对VS 2005的,但我认为过程没有改变。引导清单生成器应用程序在这里。只需单击"下载"选项卡。希望这对您有所帮助。