Building SLN on mono / Ubuntu
Asked Answered
A

1

6

I am trying to build my SLN on Ubuntu using Mono / xbuild

I started getting errors related to webapplication.targets missing and thought I'd fixed that by adding a simlink as in Webapplication.targets missing when building a MVC4 project in MonoDevelop on OS X 10.7.4

But now I get errors related to : error : Error initializing task Error: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies.

Are there any special steps I need to take to make this work? Do I need a specific version of Mono?

[UPDATE]

It seems this is an issue with the Nuget step:

azureuser@scratchpad:~/test-api/src/Model$ xbuild Model.csproj
XBuild Engine Version 12.0
Mono, Version 3.2.8.0
Copyright (C) 2005-2013 Various Mono authors

Build started 8/4/2014 11:29:09 AM.
__________________________________________________
Project "/home/azureuser/test-api/src/Model/Model.csproj" (default target(s)):
        Target EnsureNuGetPackageBuildImports:
: error : Error initializing task Error: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specif
ied.
        Task "Error" execution -- FAILED
        Done building target "EnsureNuGetPackageBuildImports" in project "/home/azureuser/test-api/src/Model/Model.csproj".-- FAILED
        Target _RecordCleanFile:
: error : Error initializing task ReadLinesFromFile: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the
 file specified.
        Task "ReadLinesFromFile" execution -- FAILED
        Done building target "_RecordCleanFile" in project "/home/azureuser/test-api/src/Model/Model.csproj".-- FAILED
Done building project "/home/azureuser/test-api/src/Model/Model.csproj".-- FAILED

Build FAILED.
Errors:

/home/azureuser/test-api/src/Model/Model.csproj (default targets) ->
(EnsureNuGetPackageBuildImports target) ->

        : error : Error initializing task Error: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the fil
e specified.

/home/azureuser/test-api/src/Model/Model.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.Common.targets (_RecordCleanFile target) ->

        : error : Error initializing task ReadLinesFromFile: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot
find the file specified.

         0 Warning(s)
         2 Error(s)

Time Elapsed 00:00:00.3989900
Antitoxin answered 4/8, 2014 at 10:13 Comment(8)
what version of ubuntu? what version of mono?Cortese
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1)Antitoxin
azureuser@scratchpad:~/test-api/src/Model$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.1 LTS Release: 14.04 Codename: trustyAntitoxin
interesting! well I think you may be hitting a mono bug which may have already been fixed, can you test with mono 3.4.x or even 3.6.x? thanksCortese
How do I update it to the latest version?Antitoxin
So I have built mono from source by following this: mono-project.com/Compiling_Mono_From_Git - how do I now install it? I ran make install but mono -V still yeilds the old v numberAntitoxin
are you familiar with installing software on linux? do you know what is a prefix, etc?Cortese
ok, you shouldn't install mono from sources on a system that already has a mono installed from packages (unless you do it in a parallel isolated environment), uninstall your mono firstCortese
T
12

I ran into the same issue, on Debian Jessie. The "hint" by knocte was right. The 3.2.8 version of mono is not enough. I installed the newest version following the instructions on the mono-project site and it works.

So, I did:

#add the Mono Project GPG signing key as trusted
apt-key adv --keyserver pgp.mit.edu --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

#add their pacages repository to apt sources
echo "deb http://download.mono-project.com/repo/debian wheezy main" > /etc/apt/sources.list.d/mono-xamarin.list

#refresh package list
apt-get update

#install newer mono & friends
apt-get install mono-devel

and then, the my previously failed xbuild, worked.

mono --version
    3.10.0 
xbuild /version 
   XBuild Engine Version 12.0
Tingley answered 21/11, 2014 at 12:16 Comment(1)
I had to modify the last command to apt-get install -t wheezy mono-devel, presumably because Debian (reasonably) assumes that jessie > wheezy.Gaskell

© 2022 - 2024 — McMap. All rights reserved.