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

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

C# crifan 2109浏览 0评论

【问题】

从VS2008转换过来的一个VS2010的C#项目,编译时出错80004005,但已经解决了:

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

但是还有错误:

------ 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 ==========

【解决过程】

1.参考msdn的:

Unable to build custom action named ‘<name>’; InstallerClass property is only valid for assemblies

先去打开Error List:

open error list

然后双击对应错误项:

unable to build custom action named

调转到对应错误位置:

error location

然后到属性窗口中设置对应的InstallerClass为False:

set installer class to false

结果错误变为了类似的另外一个问题:

Time Elapsed 00:00:02.59
------ 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)' from project output group 'Primary output' because the project output group does not have a key file.
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 ==========

即:

ERROR: Unable to build custom action named ‘Primary output from CSBrowserHelperObject (Debug x64)’ from project output group ‘Primary output’ because the project output group does not have a key file.

 

2.然后把上述四个“Primary output from CSBrowserHelperObject (Debug x64)”的InstallerClass都设置为False,结果问题依旧。

3.算了还是都改回True吧。

然后参考:Problem building Setup project for Windows Service去把所有的debug都改为release,再试试。

结果就把我前面所设置的build那两个target都清空了,没办法,还是要再加回来:

add back build target

然后当前还是同样错误。

4.去看了下那个custom actions:

custom actions fields empty

觉得很是奇怪,那个“Primary output from CSBrowserHelperObject (Debug x64)”的custom action,除了InstallerClass,其他各个域值都是空的,觉得是不是从VS2008转到VS2010中间出问题,丢失了数据了?

5.惹急了,把那四个“Primary output from CSBrowserHelperObject (Debug x64)”,都删除掉,看看结果如何。

结果编译的log变为:

Time Elapsed 00:00:02.60
------ Starting pre-build validation for project 'CSBrowserHelperObjectSetup(x64)' ------ 
------ Pre-build validation for project 'CSBrowserHelperObjectSetup(x64)' completed ------
------ Rebuild All started: Project: CSBrowserHelperObjectSetup(x64), Configuration: Release ------
Building file 'D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Release\CSBrowserHelperObjectSetup(x64).msi'...
WARNING: The target version of the .NET Framework in the project does not match the .NET Framework launch condition version '3.5.30729 '. Update the version of the .NET Framework launch condition to match the target version of the.NET Framework in the Advanced Compile Options Dialog Box (VB) or the Application Page (C#, F#).
ERROR: Could not find file 'D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\CSBrowserHelperObject\obj\x64\Debug\CSBrowserHelperObject.dll' 'The system cannot find the file specified.'
------ Starting pre-build validation for project 'CSBrowserHelperObjectSetup(x86)' ------ 
------ Pre-build validation for project 'CSBrowserHelperObjectSetup(x86)' completed ------
------ Rebuild All started: Project: CSBrowserHelperObjectSetup(x86), Configuration: Release ------
Building file 'D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Release\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 ==========

先看第一个是:

WARNING: The target version of the .NET Framework in the project does not match the .NET Framework launch condition version ‘3.5.30729 ‘. Update the version of the .NET Framework launch condition to match the target version of the.NET Framework in the Advanced Compile Options Dialog Box (VB) or the Application Page (C#, F#).

所以,去找到launch conditions:

open launch conditions

发现.NET Framework的确是3.5.30729:

framework is 3.5.30729

所以改为“.NET Framework 4”,重新编译,又出现其他错误了:

Time Elapsed 00:00:01.65
------ Starting pre-build validation for project 'CSBrowserHelperObjectSetup(x64)' ------ 
------ Pre-build validation for project 'CSBrowserHelperObjectSetup(x64)' completed ------
------ Rebuild All started: Project: CSBrowserHelperObjectSetup(x64), Configuration: Release ------
Building file 'D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Release\CSBrowserHelperObjectSetup(x64).msi'...
WARNING: The version of the .NET Framework launch condition '.NET Framework 4' does not match the selected .NET Framework bootstrapper package. Update the .NET Framework launch condition to match the version of the .NET Framework selected in the Prerequisites Dialog Box.
ERROR: Could not find file 'D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\CSBrowserHelperObject\obj\x64\Debug\CSBrowserHelperObject.dll' 'The system cannot find the file specified.'
------ Starting pre-build validation for project 'CSBrowserHelperObjectSetup(x86)' ------ 
------ Pre-build validation for project 'CSBrowserHelperObjectSetup(x86)' completed ------
------ Rebuild All started: Project: CSBrowserHelperObjectSetup(x86), Configuration: Release ------
Building file 'D:\tmp\tmp_dev_root\AutoRedirectGoogleErrorUrl\refer\IE Browser Helper Object demo (CSBrowserHelperObject)\C#\Release\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 ==========

总的感觉,好像是离正确道路,越来越远了…

转载请注明:在路上 » 【未解决】VS2010中编译一个C#项目出错:ERROR: Unable to build custom action named xxx, InstallerClass property is only valid for assemblies.

与本文相关的文章

发表我的评论
取消评论

表情

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (1)

  1. 遇到同样问题,关注中
    yuppy3年前 (2016-09-21)回复
63 queries in 0.111 seconds, using 18.41MB memory