VS 2010一键部署问题“应用程序验证未成功.无法继续“ [英] VS 2010 One Click Deployment Issue "Application Validation did not succeed. Unable to continue"

查看:41
本文介绍了VS 2010一键部署问题“应用程序验证未成功.无法继续“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Win Form应用程序,可以为其创建安装程序并进行安装.但是,当涉及到一键部署时,它不起作用,我得到以下错误.

I have a win form application that i can create an installer for and install. However when it comes to one click deployment it does not work i get the following error.

应用程序验证未成功.无法继续"

"Application Validation did not succeed. Unable to continue"

当我单击更多详细信息时,我得到以下信息.

When i click on more details i get the following.

检测到以下失败消息:

  • 清单中的引用与下载的程序集Designer.exe的标识不匹配.

我尝试了许多不同的修复程序,但均未成功.

I have tried a number of different fixes without success.

  • 我试图用清单创建应用程序.
  • 我已删除所有先决条件.
  • 我还更改了所有要包含的应用程序文件.

有人知道我该如何解决这个问题?

Does anyone know how i could fix this problem?

推荐答案

似乎根本找不到任何有关它的信息.

Cant seem to find any information about it at all.

关于此的信息很多,只需在Google上查看错误消息即可.正确的查询是清单中的引用与下载的程序集的标识不匹配",并且您会发现许多很好的命中词,描述了解决方法.

There is a lot of info about this, just google the error message. The proper query is "Reference in the manifest does not match the identity of the downloaded assembly" and you'll find lots of good hits that describe workarounds.

我将尝试做更多的事情,而不仅仅是添加另一个Google点击并解释潜在的问题.没有人解释真正出了什么问题.并希望能帮助解决难以诊断的情况.问题在于,可执行文件应用程序清单的文档记录非常少.请注意,清单"一词在Windows中具有许多含义,因此应用程序清单不同于ClickOnce清单.

I'll try to do more than just add yet another google hit and explain the underlying problem. Nobody explains what is really going wrong. And hopefully help to cover the hard-to-diagnose cases as well. At issue is a very poorly documented property of an executable file, the application manifest. Beware that the word "manifest" means many things in Windows, the application manifest is distinct from the ClickOnce manifest.

应用程序清单将 extra 配置添加到可执行文件.自Vista以来,它们非常重要,您需要用一个标记程序才能与UAC兼容.其他几种用途,您需要输入以下内容才能使用免注册的COM,更改Windows查找依赖的DLL的方式,禁用Windows appcompat填充或告诉Windows 8.1停止说谎其版本号.

The application manifest adds extra configuration to an executable file. They are very important since Vista, you need one to mark your program to be compatible with UAC. Several other uses, you need entries to use registry-free COM, alter the way Windows looks for dependent DLLs, disable Windows appcompat shims or to tell Windows 8.1 to stop lying about its version number.

与您的问题相关的一个问题是,有两种方法为可执行文件提供清单.首选方法是将其嵌入可执行文件本身.嵌入为非托管资源.使用默认设置构建Winforms应用程序时,就是通过这种方式完成的.C#或VB.NET编译器嵌入了默认的一个.或使用应用程序清单文件"项目模板添加到项目中的特定模板.最好嵌入它,因为这限制了清单可能丢失或修补的方式的数量.Windows会首先寻找它.

One issue that's relevant to your problem is that there two ways to provide the manifest for an executable. The preferred way is to embed it inside the executable file itself. Embedded as an unmanaged resource. This is the way it is done when you build a Winforms application with the default settings. The C# or VB.NET compiler embeds a default one. Or a specific one you added to your project with the Application Manifest File item template. Embedding it is preferred because the limits the number of ways the manifest could get lost or tinkered with. And is what Windows will look for first.

或者可以将其作为单独的文件提供,必须将其命名为yourapp.exe.manifest并存储在与yourapp.exe相同的目录中.这是发布"向导执行此操作的方式,您可以在发布"文件夹中找到它,并将其与可执行文件一起复制到目标计算机.

Or it can be provided as a separate file, it must be named yourapp.exe.manifest and stored in the same directory as yourapp.exe. This is the way the Publish wizard will do it, you can find it back in the publish folder and it will be copied to the target machine along with the executable.

也许您能闻到迫在眉睫的问题,两个清单,但它们不匹配.System.Deployment遵循Windows规则, first 查找嵌入式清单.它将找到C#编译器嵌入的默认目录.它将对照 ClickOnce清单中声明的程序集身份进行检查.如果不匹配,则在kaboom中显示清单中的引用与下载的程序集的标识不匹配".它认为可执行文件在从Web服务器到用户计算机的过程中被中间人攻击所取代.

Perhaps you can smell the looming problem, two manifests and they don't match. System.Deployment follows the Windows rules and first looks for an embedded manifest. It will find the default one that the C# compiler embeds. It checks the assembly identity against the one declared in the ClickOnce manifest. And if it doesn't match then, kaboom with "Reference in the manifest does not match the identity of the downloaded assembly". It thinks the executable file was replaced while it traveled from your web server to the user's machine by a man-in-the-middle attack.

首先通过查看嵌入在可执行文件(Designer.exe)中的非托管资源开始诊断此问题,该文件是System.Deployment首先查看的资源.在Visual Studio中,使用文件+打开+文件,然后从发布文件夹中选择Designer.exe.它可能类似于:

You start diagnosing this problem by first looking at the unmanaged resources embedded inside your executable file (Designer.exe), the ones that System.Deployment looks at first. In Visual Studio, use File + Open + File and select Designer.exe from the publish folder. It will probably resemble this:

ID为#1的RT_MANIFEST条目是嵌入式应用程序清单.您可以双击它进行查看,但是会得到内容的十六进制转储.右键单击,导出并指定一个.txt文件名比较容易,因此您可以使用文本编辑器查看它.它将类似于以下内容:

The RT_MANIFEST entry with ID #1 is the embedded application manifest. You can double-click it to have a look but you'll get a hex dump of the content. Easier is to right-click, Export and specify a .txt file name so you can look at it with a text editor. It will resemble something like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

< assemblyIdentity> 元素是麻烦的制造者.注意它如何具有通用名称"MyApplication.app"和默认版本号1.0.0.0.如果查看发布向导生成的yourapp.exe.manifest文件,则会看到类似以下内容的内容:

The <assemblyIdentity> element is the trouble-maker. Note how it has a generic name, "MyApplication.app" and a default version number of 1.0.0.0. If you look at the yourapp.exe.manifest file that the Publish wizard generated then you'll see something like this:

  <asmv1:assemblyIdentity name="WindowsFormsApplication86.exe" version="1.0.0.0" 
     publicKeyToken="e939ba736dc34835" language="neutral" 
     processorArchitecture="msil" type="win32" /> 

甚至没有关闭.卡布姆

几种解决方法:

  • 在可执行文件的文件+打开+文件"视图仍处于打​​开状态的情况下,右键单击清单ID#1,然后选择删除".它将全部删除,System.Deployment现在将找到该文件
  • 项目+属性,在应用程序"选项卡上,将清单"选项更改为创建没有清单的应用程序".这应该是您首选的解决方案
  • 如果您需要自定义清单并使用了应用程序清单文件,则必须再次将其删除,然后编辑发布向导生成的yourapp.exe.manifest文件.这很痛苦,最好避免,因为您需要重复执行此操作
  • 更新您的VS版本,此问题已得到解决,并且现在已经足够聪明,可以在发布时重新构建项目,而现在没有默认清单.我认为从VS2012开始,绝对是从VS2013开始.
  • With the File + Open + File view of the executable still open, right-click the manifest ID #1 and select Delete. That removes it entirely, System.Deployment will now find the file instead
  • Project + Properties, Application tab, change the Manifest option to "Create application without a manifest". This should be your preferred solution
  • If you require a custom manifest and used the Application Manifest File then you must remove it again and instead edit the yourapp.exe.manifest file that the Publish wizard generated. This is quite painful and best avoided since you need to repeatedly do this
  • Update your VS version, this problem has been fixed and it is now smart enough to rebuild your project, now without the default manifest, when you publish. I think starting at VS2012, definitely for VS2013.

这篇关于VS 2010一键部署问题“应用程序验证未成功.无法继续“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆