Category: .NET

Compile .NET source code on Ubuntu 14.04

1. Build the latest mono from source. You can also install from apt-get. But if the source code contains C#6.0 code, you'll get error. The build process like following:

build mono from source
apt-get install git autoconf libtool automake build-essential mono-devel gettext
wget http://download.mono-project.com/sources/mono/mono-4.6.0.243.tar.bz2  842  cd mono-4.6.0.243.tar.bz2
tar xvf mono-4.6.0.243.tar.bz2
cd mono-4.6.0
./configure —prefix=/usr/local
make
make install

2.Download nuget from release. And also download Microsoft.Build.zip

3.Get the Nuget projects:

chmod +x NuGet.exe
./NuGet.exe restore your_solution.sln

4.Build the full solution:

xbuild your_solution.sln

Running .net2.0 application using .net4.0 framework

We only need to create a new file called xxx.exe.config.
note: xxx.exe is your donet application.

Then fill the following codes to the config file:

<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>