简体   繁体   中英

C# Mono on mac - compile and run another project with code

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

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 .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM