Skip to content

MSBuild fails on Linux/Mono with TypeLoadException #49

@amanda-mitchell

Description

@amanda-mitchell

Steps to reproduce

  1. Build MSBuild in the Debug-MONO configuration and copy it to an Ubuntu 14.04 box with Mono 3.12.1 from the official Xamarin mono-devel package.
  2. Clone https://github.com/mono/coreclr.git
  3. Run mono {path to msbuild} {path to coreclr}/src/build.proj -nologo -p:OS=Unix

Expected result

Something approximating a build

Actual result

The following crash occurred:

Invalid type Microsoft.Build.Execution.BuildManager for instance field Microsoft.Build.Execution.BuildSubmission:<BuildManager>k__BackingField
MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
System.TypeLoadException: A type load exception has occurred.
  at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String commandLine) [0x00000] in <filename unknown>:0
This is an unhandled exception in MSBuild Engine -- PLEASE OPEN A BUG AGAINST THE MSBUILD TEAM.
System.TypeLoadException: A type load exception has occurred.
  at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String commandLine) [0x00000] in <filename unknown>:0

Unhandled Exception:
System.TypeLoadException: A type load exception has occurred.
  at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String commandLine) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: A type load exception has occurred.
  at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String commandLine) [0x00000] in <filename unknown>:0
vagrant@vagrant-ubuntu-trusty-64:/vagrant/git/msbuild/bin/Windows_NT/Debug-MONO$

Additional notes

Through further investigation, I discovered that the TypeLoadException is the result of not being able to load TPL dataflow.

I was able to fix this issue by finding the dependency in Microsoft.Build and setting Copy Local to True in the properties pane, but I don't know if this is the right solution or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions