Skip to content

Error MSB4216 when building a project that holds a reference to an x86 project with a resource file #4229

Description

@dockell

The attached solution contains three projects:

  • TestRandom, a simple .Net app that holds a reference to
  • TestX86: a .Net app that has Platform Target set to x86 and has a resources file (with a single string resource)
  • TestBuildProject: another simple .Net app that uses Microsoft.Build.Evaluation.Project.Build() to build TestRandom.

The full exception message is:
C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(2554,5): error MSB4216: Could not run the "GenerateResource" task because MSBuild could not create or connect to a task host with runtime "CLR4" and architecture "x86". Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" exists and can be run.
C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(2575,7): error MSB4028: The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter. Object does not match target type.

This is an example project cut down from the full project that I use to build a large number of utility dlls.

If the resource is removed from TestX86, TestBuildProject runs fine.
If TestX86's Platform Target is set to 'any' or 'x64', TestBuildProject runs fine.

My test machine is running 64-bit Windows 10, Version 10.0.17134 Build 17134

TestRandom.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions