4

I am trying to build an automatic download, compile & run program for a project just to make it easier for other users on mac and myself so we do not have to do everything over and over as the project progresses. I cant find anything on how to compile and run a C# monodevelop project with code when i google. Does anyone here know how it could be done?

thanks

Edit: using xbuild as mentioned below compiles the project, but i cannot seem to find a command to run the build? the only output seems to be .exe and that launches vmware when i try to run, is there som command that i add somewhere? like execute

tar -xf sources.tar.gz
cd *project*
xbuild project.sln
Viktor Alm
  • 41
  • 1
  • 4

2 Answers2

5

To build applications you can use gmcs , to run then you can use mono. From a Terminal shell, you can try it out:

$ gmcs hello.cs
$ mono hello.exe
Hello, World
aloisdg
  • 22,270
  • 6
  • 85
  • 105
Udrian
  • 76
  • 6
4

The full answer of course depends on the sources concerned and the build system it uses. For mono relates sources you can often do the following:

tar -xf sources.tar.gz
cd sources
./configure
make
sudo make install

If you have a .sln file and csproj files, you need to use mdtool or xbuild. mdtool comes with monodevelop, xbuild comes with mono. Both understand visual studio solution and csproj files and will build them. xbuild a mono equivalent of msbuild.

IanNorton
  • 7,145
  • 2
  • 25
  • 28
  • I am completely new to terminal though I did create a file. touch filename pico filename then i added your code. saved and chmodded to 755. I put the file in the directory of the downloaded source.tar.gz that my program does, but when i try to run it it says it cant find the file. Im trying to run a monodevelop project. – Viktor Alm Sep 29 '11 at 21:40
  • @ViktorAlm you will have to run the script, "./filename" should do it – IanNorton Sep 29 '11 at 21:49
  • Error opening archive: Failed to open './sources.tar.gz': No such file or directory – Viktor Alm Sep 29 '11 at 21:58
  • change to the directory you download to, perhaps 'cd ~/Downloads' – kenny Sep 29 '11 at 22:27
  • @ViktorAlm I'm guessing your source archive isn't called 'sources.tar.gz' :) – IanNorton Sep 30 '11 at 06:00
  • I have fixed that, it was just me not being used to the terminal. I want to compile and run the file and this just seems to compile – Viktor Alm Oct 02 '11 at 20:14