Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you use Mono's mcs to compile and run a csproj file?

Tags:

c#

mono

gmcs

I'm a Unix guy who needs to try and compile some C# code for work. I've downloaded Mono for Mac, and the mcs command line tool. There's a csproj file attached to this library which contains XML with all of the files I need to compile.

Can Mono/mcs read this csproj file and generate a DLL from it?

like image 687
Kevin Burke Avatar asked Dec 01 '12 22:12

Kevin Burke


4 Answers

If you don't want to use MonoDevelop and want to use the command-line, you can use xbuild. xbuild is the Mono equivalent of MSBuild.

xbuild /p:Configuration=Release HelloWorld.csproj
like image 148
Greg Najda Avatar answered Oct 17 '22 21:10

Greg Najda


The easiest way is to head over to monodevelop and download their IDE. It can open project files generated by Visual Studio.

Now you can also use the convenience of aptitude as below:

sudo apt-get install monodevelop mono-gmcs
like image 4
vidstige Avatar answered Oct 17 '22 22:10

vidstige


This question is old and answers are deprectated. I succeed to generate and run DLL from a csproj by following theses steps:

  • install dotnet : https://dotnet.microsoft.com/download. For linux, follow theses steps : https://learn.microsoft.com/en-us/dotnet/core/install/linux
  • For ubuntu and osx you should have openssl installed apt-get install openssl

Then, use dotnet build YourProject.csproj to compile the project and dotnet run YourProject.csproj to run it.

like image 3
Benjamin Lucidarme Avatar answered Oct 17 '22 22:10

Benjamin Lucidarme


For Ubuntu, and probably other Debian-based distributions:

sudo apt-get install monodevelop mono-gmcs

(mono-gmcs may be needed to compile .net 2.0 or 3.5 projects)

like image 1
mivk Avatar answered Oct 17 '22 21:10

mivk