C# WinForms - 应用程序安装错误 - 清单中的引用与下载的程序集的标识不匹配
背景:我有一个用 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
在引用下,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)
这是 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();
感谢您的查看!
Background: I have a winforms app written in C# that converts xlsx files to csv by calling a 2nd entirely seperate application ConvertExcelTo.Exe from the command line.
Error Summary:
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
- How/Where do I edit the Manifest and References section?
- What do I have to change to make this install correctly without any errors??
Under References, ConvertExcelTo I have: Assembly ConvertExcelTo -
C:\Users\bmccarthy\Documents\Visual Studio 2008\Projects\CCP Utility 3-31-11\CCP Utility\bin\Debug\ConvertExcelTo.exe
Under References, ConvertExcelTo.vshost I have: {} Microsoft.VisualStudio.HostingProcess, EntryPoint, Base Types, Objects: ~Object(), Equals(object, object), Equals(object), GetHashCode(), GetType(), MemberwiseClone(), Object(), ReferenceEquals(object, object), ToString().
Full Error Details:
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)
Here's the code in MainForm.cs where I call the ConvertExcelTo.exe application:
//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();
Thanks for looking!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这不是您正在做的事情,您实际上是在尝试加载该 EXE 程序集。两次,一次通过可执行文件的 Visual Studio 托管进程版本,仅在调试 EXE 时相关。再次通过常规 EXE。这在 .NET 中是有可能的,在某些特定情况下会派上用场,这在 .NET 中有点奇怪。不在这里,CLR 对此大发雷霆。
删除您添加的程序集引用。使用 Process 类来启动该程序。
That's not what you are doing, you are actually trying to load that EXE assembly. Twice, once through the visual studio hosting process version of the executable, relevant only when you debug an EXE. Again through the regular EXE. It's a bit of a quirk in .NET that this is even possible, comes in handy in very select cases. Not here, the CLR is throwing a hissy fit at this.
Remove the assembly references you added. Use the Process class to start this program.
感谢您的澄清。请在此处查看此页面。这将引导您完成如何编辑部署清单。您应该将 ConvertExcelTo.exe 作为另一个应用程序安装。您可以通过清单将其添加为安装过程的先决条件,并将其引导至安装。有关引导的一些信息此处。这是针对 VS 2005 的,但我认为该过程没有改变。 Bootstrap Manifest Generator 应用位于此处。只需单击“下载”选项卡即可。希望这对您有帮助。
Thanks for the clarification. Take a look at this page here. This steps you through how to edit the deployment manifest. You should install the ConvertExcelTo.exe as another application. You can add it as a prereq for your install process through the manifest and bootstrap it to the install. Some info on bootstrapping here. It's for VS 2005, but I don't think the process has changed. Bootstrap Manifest Generator app is here. Just click on the Downloads tab. Hope this helps you out.