Why do I get “An error occurred while validating. HRESULT = '80004005'” when building a setup project?

前端 未结 11 587
北荒
北荒 2020-12-09 09:10

Why do I get the following error when building a setup project?

An error occurred while validating. HRESULT = \'80004005\'

相关标签:
11条回答
  • 2020-12-09 09:20

    Both of the reasons I found are already in other answers, but they are in separate answers and not fully explained. So, hopefully this will combine the possibilities and give good means of debugging each. :)

    Common Reason

    My problem was not a dependency error. However, that does seem to be the common reason. So, basically, you need to check your MSI file and make sure that all dependencies are still valid. Probably the best blog response on how you can easily resolve this if it is a dependency issue is An error occurred while validating. HRESULT = '80004005'.

    Extract from blog:

    Follow steps below to troubleshoot.

    • If you have multiple project outputs in your solution, identify the project that is giving the problem. You can do that by removing one project at a time from the Setup Project(S) until error goes away.
    • Once project is identified, identify the reference that could be giving the problem.

      • Check if the project(A) is referencing to a project that has been removed from solution. - Remove such references if any.
      • Check if the Project(A) is referencing to a project that was moved to a diffenrent physical location after it was added as a reference. - Remove and add such references.
    • Rebuild setup project after fixing the reference accordingly to see if error goes away.

    Alternative Reason

    My problem had to do with Visual Studio versioning, however. So, if your dependencies are valid and you still are getting this problem, then you resolve this if it is a problem with VS2010 .

    Basically, if you run MSBuild and see this warning:

    Project file contains ToolsVersion="4.0", which is not supported by this version of MSBuild. Treating the project as if it had ToolsVersion="3.5"

    Then the problem is Visual Studio versioning. This means that one project was opened or created in Visual Studio 2010 and then saved or added to an existing 3.5 solution. I simply searched all files in my project for ToolsVersion="4.0" and found the offending .csproj file, opened it in a text editor and manually changed the 4.0 to a 3.5.

    0 讨论(0)
  • 2020-12-09 09:20

    In my case my solution (VS2008) had a project that was also referenced from another solution (VS2010). In the VS2010 solution I had upgraded the project to .NET 4.0. When I later realized the project was also used in another solution I downgraded it to .NET 3.5. For some reason everything seemed to be changed correctly in the csproj file except one place which is mentioned here: Error in setup project HRESULT = '80004005'

    I know this is already solved somewhere else but I wanted to shed some light on this from another problem angle.

    0 讨论(0)
  • 2020-12-09 09:31

    I read this answer from another post on Stack Overflow, and it has worked for me.

    Open your setup project file (.vdproj) in Notepad (or any other text editor). Delete these lines at a beginning of the .vdproj file:

    "SccProjectName" = "8:"
    "SccLocalPath" = "8:"
    "SccAuxPath" = "8:"
    "SccProvider" = "8:"
    

    Build again - the error is gone. That error didn't stop me from deploying, building, debugging (or anyting) my project; it just annoyed me. And it came on even if I set all projects to be build in a current configuration and the setup project not to.

    0 讨论(0)
  • 2020-12-09 09:35

    One project in solution had ToolsVersion="4.0" (in .csproj file), changed it to ToolsVersion="3.5" and setup project builds fine.

    0 讨论(0)
  • 2020-12-09 09:35

    This error is related to a dependency error. I removed all references to my primary output project and added them again. It now compiles OK!

    0 讨论(0)
  • 2020-12-09 09:39

    I have spent enormous time on this one myself, though none of the above worked. But I have found another solution with a registry hack, you need to add a new DWORD (EnableOutOfProcBuild) value of (0) to HKCU\SOFTWARE\Microsoft\VisualStudio\14.0_Config\MSBuild\EnableOutOfProcBuild

    Note: this is for Visual Studio 2015

    0 讨论(0)
提交回复
热议问题