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

3

43

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?

Lex answered 1/12, 2012 at 22:34 Comment(0)
T
67

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
Throat answered 2/12, 2012 at 1:54 Comment(4)
xbuild is deprecated, it's call msbuild nowMascot
Here's proof of what @Mascot saidComanche
I posted the new correct method to compile and run C# in answers : https://mcmap.net/q/380220/-how-can-you-use-mono-39-s-mcs-to-compile-and-run-a-csproj-fileSanborn
@BenjaminLucidarme this is just building some .NET app - not Mono.Invade
M
4

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
Metope answered 1/12, 2012 at 22:36 Comment(0)
S
1

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

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

Sanborn answered 2/11, 2020 at 13:35 Comment(1)
This wont build .csproj on MonoInvade

© 2022 - 2024 — McMap. All rights reserved.