Bug 32561

Summary: Could not load file or assembly Microsoft.Build.Utilities
Product: [Mono] Class Libraries Reporter: Ondra Pelech <ondra.pelech>
Component: Ms.BuildAssignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: masafa, mono-bugs+mono
Priority: ---    
Version: 4.0.0   
Target Milestone: Untriaged   
Hardware: PC   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:

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] 
[exec] Unhandled Exception:
[exec] System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
[exec] File name: 'Microsoft.Build.Utilities, Version=2.0.0.0, 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:
https://travis-ci.org/sideeffffect/choco#L2133


When researching this problem, I've come across TeamCity issue
https://youtrack.jetbrains.com/issue/TW-41890


I've found another repository that seems to suffer from the same problem
https://travis-ci.org/ethomson/infinity.net/builds/70105944#L1470

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
https://travis-ci.org/ethomson/infinity.net/builds/46405700


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!