Bug 32561 - Could not load file or assembly Microsoft.Build.Utilities
Summary: Could not load file or assembly Microsoft.Build.Utilities
Alias: None
Product: Class Libraries
Classification: Mono
Component: Ms.Build ()
Version: 4.0.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2015-07-29 06:39 UTC by Ondra Pelech
Modified: 2015-07-31 14:15 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Ondra Pelech 2015-07-29 06:39:09 UTC
I get the following error:

[exec] Starting '/usr/bin/xbuild (/home/travis/build/sideeffffect/choco/src/chocolatey.sln /nologo /property:OutputPath='/home/travis/build/sideeffffect/choco/build_output/chocolatey' /property:Configuration=Release /verbosity:detailed /toolsversion:4.0 /property:Platform='Any CPU'  /property:TargetFrameworkProfile='' /property:TargetFrameworkVersion=v4.0 /l:ThoughtWorks.CruiseControl.MSBuild.XmlLogger,"/home/travis/build/sideeffffect/choco/lib/NAnt/ThoughtWorks.CruiseControl.MSBuild.dll";'/home/travis/build/sideeffffect/choco/build_output/build_artifacts/compile/msbuild-mono-4.0-results.xml')' in '/home/travis/build/sideeffffect/choco/build_output'
[exec] Unhandled Exception:
[exec] System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build.Utilities, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
[exec] File name: 'Microsoft.Build.Utilities, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[exec]   at (wrapper managed-to-native) System.Reflection.Assembly:InternalGetType (System.Reflection.Assembly,System.Reflection.Module,string,bool,bool)
[exec]   at System.Reflection.MonoAssembly.GetType (System.String name, Boolean throwOnError, Boolean ignoreCase) [0x00000] in <filename unknown>:0 
[exec]   at System.Reflection.Assembly.GetType (System.String name) [0x00000] in <filename unknown>:0 
[exec]   at Mono.XBuild.CommandLine.MainClass.Execute () [0x00000] in <filename unknown>:0 
[exec]   at Mono.XBuild.CommandLine.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0 

you can see the full log here:

When researching this problem, I've come across TeamCity issue

I've found another repository that seems to suffer from the same problem

interresting thing is, that the previous build from 7 months ago (from this other repository) succeeded. this suggests, that this is a bug in Mono introduced in the meantime

the issue tracked at Chocolatey https://github.com/chocolatey/choco/issues/369
Comment 1 Marek Safar 2015-07-31 07:53:42 UTC
It should be fixed in master and Mono 4.2 (i could not reproduce it locally).

However,I'd recommend to migrate away from nant which is .net 2.0 app and Mono 4.x officially support .net 4.0 and newer apps only.
Comment 2 Ondra Pelech 2015-07-31 12:12:05 UTC
> nant is .net 2.0 app

but http://nant.sourceforge.net claims otherwise
Comment 3 Marek Safar 2015-07-31 13:55:01 UTC
The page does not say anything (except how outdated nant is) about what nant is compiled with. Simple ildasm/ildasm/monodis the .exe and you will see yourself
Comment 4 Ondra Pelech 2015-07-31 14:15:11 UTC
ok, thank you!