最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

【已解决】VS 2010编译项目出错:ERROR: An error occurred while validating. HRESULT = ‘80004005’

C# crifan 1932浏览 0评论

【问题】

用VS2010编译一个C#的项目时:

【记录】为IE9编写一个插件AutoRedirectGoogleErrorUrl,用于对于,点击google搜索到的但点击时无法打开的地址,实现自动跳转到原始地址

想要编译CSBrowserHelperObjectSetup(x64)时,却出现错误:

------ Rebuild All started: Project: CSBrowserHelperObject, Configuration: Debug Any CPU ------
Build started 8/27/2012 3:47:38 PM.
CoreClean:
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Debug\CSBrowserHelperObject.dll".
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Debug\CSBrowserHelperObject.pdb".
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\CSBrowserHelperObject\obj\Debug\Interop.SHDocVw.dll".
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\CSBrowserHelperObject\obj\Debug\CSBrowserHelperObject.csproj.ResolveComReference.cache".
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\CSBrowserHelperObject\obj\Debug\CSBrowserHelperObject.dll".
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\CSBrowserHelperObject\obj\Debug\CSBrowserHelperObject.pdb".
ResolveComReferences:
  C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\TlbImp.exe C:\Windows\SysWOW64\ieframe.dll /namespace:SHDocVw /machine:X86 /out:obj\Debug\Interop.SHDocVw.dll /sysarray /transform:DispRet /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Configuration.Install.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll /keyfile:BrowserHelperObject.snk 
CoreCompile:
  C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Configuration.Install.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\assembly\GAC\Microsoft.mshtml\7.0.3300.0__b03f5f7f11d50a3a\Microsoft.mshtml.dll /reference:obj\Debug\Interop.SHDocVw.dll /debug+ /debug:full /filealign:512 /keyfile:BrowserHelperObject.snk /optimize- /out:obj\Debug\CSBrowserHelperObject.dll /target:library BHOIEContextMenu.cs BHOInstaller.cs BHOInstaller.Designer.cs HTMLDocumentEventHelper.cs HTMLEventHandler.cs IObjectWithSite.cs Properties\AssemblyInfo.cs
CopyFilesToOutputDirectory:
  Copying file from "obj\Debug\CSBrowserHelperObject.dll" to "..\Debug\CSBrowserHelperObject.dll".
  CSBrowserHelperObject -> D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Debug\CSBrowserHelperObject.dll
  Copying file from "obj\Debug\CSBrowserHelperObject.pdb" to "..\Debug\CSBrowserHelperObject.pdb".
  Copying file from "obj\Debug\Interop.SHDocVw.dll" to "..\Debug\Interop.SHDocVw.dll".

Build succeeded.

Time Elapsed 00:00:01.89
------ Starting pre-build validation for project 'CSBrowserHelperObjectSetup(x64)' ------ 
ERROR: An error occurred while validating.  HRESULT = '80004005'
------ Pre-build validation for project 'CSBrowserHelperObjectSetup(x64)' completed ------
------ Rebuild All started: Project: CSBrowserHelperObjectSetup(x64), Configuration: Debug ------
------ Starting pre-build validation for project 'CSBrowserHelperObjectSetup(x86)' ------ 
------ Pre-build validation for project 'CSBrowserHelperObjectSetup(x86)' completed ------
------ Rebuild All started: Project: CSBrowserHelperObjectSetup(x86), Configuration: Debug ------
Building file 'D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Debug\CSBrowserHelperObjectSetup(x86).msi'...
ERROR: Unable to build custom action named 'Primary output from CSBrowserHelperObject (Debug x86)', InstallerClass property is only valid for assemblies.
Build process cancelled
========== Rebuild All: 1 succeeded, 2 failed, 0 skipped ==========

 

【解决过程】

1.去参考:已答复An error occurred while validating. HRESULT = ‘80004005’,但是没找到其所说的“project\signing\create test certificate”

2.参考:How to fix the issue: An error occurred while validating. HRESULT = ‘80004005’,却找不到其所说的“ToolsVersion="4.0"”是在哪里的。

3.参考:解决error occurred while validating. HRESULT = ’8000000A’ and"Unable to update the dependencies of the project.问题,去:

project dependency

这个是当前默认的选择:

default dependency

看起来本身就是好好的,不需要修改。

然后重新编译项目,错误依旧。

4.按照上面帖子,重新关闭VS2010,再打开试试。结果问题依旧。

5.后来点击该项目,选择refresh dependencies:

refresh dependencies

结果问题依旧。

6.后来还是参考:How to fix the issue: An error occurred while validating. HRESULT = ‘80004005’然后去搜:

ToolsVersion="4.0"

然后找到:VS2010,VS2008,VS2005;工程之间的转换,然后注意到:

我此处的CSBrowserHelperObject.sln本身就是:

 

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010

了,另外也才知道原来对应的ToolsVersion是在csproj文件:

CSBrowserHelperObject\CSBrowserHelperObject.csproj

中的,将其用Notepad++打开后,把对应的

ToolsVersion="4.0"

改为:

ToolsVersion="3.5"

ToolsVersion

(注意修改之前,当前先要关闭VS2010)

同时也注意到CSBrowserHelperObject.csproj.user中,也是ToolsVersion="4.0",也去该其改为3.5:

user file also change to 3.5

7. 然后重新打开VS2010,结果又遇到了那个要求项目转换的事情:

need conversion

只有继续转换了。。。

结果竟然遇到了那个悲催的“An error occurred while validating HRESULT = ‘8000000A’”:

an error occured while validating HRESULT = 8000000A

然后去编译项目,又回到了最开始的80004005错误了。又回到了原点了。。。

8.再去安装那个帖子,去unload project:

unload project

然后修改CSBrowserHelperObject.csproj中的ToolsVersion为3.5,再去reload project:

reload project

此法,和之前手动修改的,效果一样,所以结果问题依旧,还是80004005的错误。

9.再参考:

Visual Studio 2008: ‘an error occurred while validating. HRESULT=80004005’ when building Installer Project

去把4.0和旧的3.5改为 3.5和旧的2.0:

3.5 and 2.0

再打开VS2010,同样会提示项目转换,继续转换,结果,同样的,还是遇到了8000000A的错误。

10。尝试去把整个项目原先依赖的.NET Framework从3.5改为4.0:

change framework from 3.5 to  4.0

再重新编译试试,编译log如下:

------ Rebuild All started: Project: CSBrowserHelperObject, Configuration: Debug Any CPU ------
Build started 8/27/2012 4:52:41 PM.
CoreClean:
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Debug\CSBrowserHelperObject.dll".
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Debug\CSBrowserHelperObject.pdb".
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\CSBrowserHelperObject\obj\Debug\Interop.SHDocVw.dll".
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\CSBrowserHelperObject\obj\Debug\CSBrowserHelperObject.csproj.ResolveComReference.cache".
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\CSBrowserHelperObject\obj\Debug\CSBrowserHelperObject.dll".
  Deleting file "D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\CSBrowserHelperObject\obj\Debug\CSBrowserHelperObject.pdb".
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
  C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Configuration.Install.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" /reference:C:\Windows\assembly\GAC\Microsoft.mshtml\7.0.3300.0__b03f5f7f11d50a3a\Microsoft.mshtml.dll /reference:obj\Debug\Interop.SHDocVw.dll /debug+ /debug:full /filealign:512 /keyfile:BrowserHelperObject.snk /optimize- /out:obj\Debug\CSBrowserHelperObject.dll /target:library BHOIEContextMenu.cs BHOInstaller.cs BHOInstaller.Designer.cs HTMLDocumentEventHelper.cs HTMLEventHandler.cs IObjectWithSite.cs Properties\AssemblyInfo.cs "C:\Users\CLi\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.cs"
CopyFilesToOutputDirectory:
  Copying file from "obj\Debug\CSBrowserHelperObject.dll" to "..\Debug\CSBrowserHelperObject.dll".
  CSBrowserHelperObject -> D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Debug\CSBrowserHelperObject.dll
  Copying file from "obj\Debug\CSBrowserHelperObject.pdb" to "..\Debug\CSBrowserHelperObject.pdb".
  Copying file from "obj\Debug\Interop.SHDocVw.dll" to "..\Debug\Interop.SHDocVw.dll".

Build succeeded.

Time Elapsed 00:00:01.98
------ Starting pre-build validation for project 'CSBrowserHelperObjectSetup(x64)' ------ 
------ Pre-build validation for project 'CSBrowserHelperObjectSetup(x64)' completed ------
------ Rebuild All started: Project: CSBrowserHelperObjectSetup(x64), Configuration: Debug ------
Building file 'D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Debug\CSBrowserHelperObjectSetup(x64).msi'...
ERROR: Unable to build custom action named 'Primary output from CSBrowserHelperObject (Debug x64)', InstallerClass property is only valid for assemblies.
Build process cancelled
------ Starting pre-build validation for project 'CSBrowserHelperObjectSetup(x86)' ------ 
------ Pre-build validation for project 'CSBrowserHelperObjectSetup(x86)' completed ------
------ Rebuild All started: Project: CSBrowserHelperObjectSetup(x86), Configuration: Debug ------
Building file 'D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Debug\CSBrowserHelperObjectSetup(x86).msi'...
ERROR: Unable to build custom action named 'Primary output from CSBrowserHelperObject (Debug x86)', InstallerClass property is only valid for assemblies.
Build process cancelled
========== Rebuild All: 1 succeeded, 2 failed, 0 skipped ==========

可见,至少就消除了原先的:

“An error occurred while validating. HRESULT = ‘80004005’”

的错误,但是仍旧有之前就出现的那个错误:

ERROR: Unable to build custom action named ‘Primary output from CSBrowserHelperObject (Debug x64)’, InstallerClass property is only valid for assemblies

所以,可以算是解决了此问题了,剩下的就是解决余下的问题了。

详情参考:

【未解决】VS2010中编译一个C#项目出错:ERROR: Unable to build custom action named xxx, InstallerClass property is only valid for assemblies.

 

【总结】

此处的项目是从VS 2008转换过来的,其原先依赖于.NET Framework 3.5的,此处转换到VS 2010的项目后,编译遇到错误:

An error occurred while validating. HRESULT = ‘80004005’

尝试过:

1.将xxx.csproj中的ToolsVersion从4.0改为3.5

2.refresh dependencies

等办法,都没解决,最终解决办法是:

将(项目属性->应用程序->目标依赖库中的).NET Framework从3.5改为4.0即可消除那个“An error occurred while validating. HRESULT = ‘80004005’”的错误。

转载请注明:在路上 » 【已解决】VS 2010编译项目出错:ERROR: An error occurred while validating. HRESULT = ‘80004005’

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
59 queries in 0.119 seconds, using 18.98MB memory