How to compile with Mono from the command line? - mono

I've installed monodevelop to give it a try.
I'm able to compile hello-worlds and run it with the monodevelop's GUI, but I would like to also make the equivalent from the command line.
Could someone tell me what is the command line to compile the .cs files?
https://gist.github.com/fccm/cc196a2816b66b66463e425cf1e62adb
Thanks in advance

Yes, msbuild is available on Linux for a while. Build your project with:
msbuild helloworld.csproj
Execute with:
mono helloworld.exe

Related

Running software build in MSYS2 MINGW32 shell

I'm trying to run a piece of software I built in MSYS2 MINGW32 shell. The software is 32bits (don't have time to port it to 64bits) and there is one statically linked executable. Here is how I setup the build environment:
Installed a fresh copy of MSYS2;
$ pacman -Syu
Installed the following packages: git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-SDL mingw-w64-i686-SDL_mixer mingw-w64-i686-zlib mingw-w64-i686-libpng mingw-w64-i686-make
Git checkout the repo
Run the build in CMake
Build runs fine and the exe is generated.
Now the problem starts: the executable can't run and displays an error message about missing DLLs. I copied the missing DLLs to the same folder of the executable, and them another error message pops up complaining about error 0xC000007B, which I tracked down to be missing dependencies. After a while I figured out that the problem was that some of the DLLs is missing a dependency itself. Copied this last dependency to the folder.
Now, the big question: I can run the exe perfectly fine in the MINGW32 shell but I can't run it neither in cmd.exe nor by double-clicking in Windows Explorer and this is a problem (I can't ship a software this way). Is there any way to produce a binary that is able to run from explorer and from cmd.exe? What is the cause of this problem? Can it be mitigated?
I solved my problem!
After a lot of research, I realized that nothing was wrong with my MSYS2 build/setup/dependencies. The real problem was that CMake hide one parameter for the linker: -mwindows. Actually, the CMake find_package routine from one of the libraries I'm using (SDL) added this parameter to the linker command line parameters.
Adding a -mconsole to the linker parameters (using add_link_options("-mconsole")) solved the problem. The CLI now works as expected.
Thank you all for your help.

How can I build liquidfun library with cmake?

I am trying to run SFML-LiquidFun-Water-master open source file (https://github.com/alextrevisan/SFML-LiquidFun-Water) on VS2015, but it had some errors (such as there is no proper library "Box2D", "Liquidfun"), I realized that I have to install liquidfun librabry and bring it to the source code which I want to run. I downloaded liquidfun library from https://github.com/google/liquidfun and Cmake from https://cmake.org/ and followed instructions based on here http://google.github.io/liquidfun/Building/html/md__building_windows.html but It keep saying that there is no such command name Cmake whatever.. What am I supposed to do to run source code thank you!!

How do I run a EXE Go executable from within IntelliJ IDEA?

I have a Go program which I'm working on in IntelliJ IDEA on a Windows machine. The program's structure is a little unconventional (don't want to go into detail here as its besides the point) because of which I first have to compile the program using the following command:
go build -o cli.exe
And then I can run cli.exe directly in the command prompt.
But how do I configure the run configuration in IntelliJ IDEA so that it doesn't mind running a Windows executable ? Because if I try to tell it to run an EXE file as it's run configuration, it gives me error "Main file is invalid"
How do I solve this ?
Make sure you have a file name (not a folder name) in field File on Run/Debug Configuration window (In IntelliJ IDEA go to menu Run->Edit Configuration...->your_configuration). That was my case.
You may be able to install the Bash plugin on Windows, then create a run configuration using the Bash plugin, and just run your executable from a script.
Create a Go Application run configuration and that should work. You can choose to run either a file or a package. If you would share more details then the answer would be more complete. If you still have an issue with this, please open an issue to the bug tracker and I'll be able to help out (please follow the issue template there).

Monodevelop: "MSBuild process could not be started"

I just installed monodevelop on Arch Linux using pacman. I can compile with the mcs command, but I can not build in monodevelop. I am told "MSBuild process could not be started". The same error is given if I try building with mdtool on the command line.
Go to the project options of your project in monodevelop. At Build -> General, there is a new option called Use MSBuild engine (recommended for this project type). Uncheck this option.
Please refer to post Bug 33896 - Build fails if LANG is set to a UTF8 locale.
Basically you have to start monodevelop with something like LC_ALL=C monodevelop and you can use MSBuild.
Even better option is to enable non-utf8 locale for your region. Edit the content of /etc/locale.gen and un-comment your non-utf8 regional locale. Then run command
locale-gen
to regenerate locales and
locale -a
to verify that new locale is available. In my case (Slovenia) I then start monodevelop with
LC_ALL=sl_SI monodevelop
Or you can disable MSBuild as described in previous answer.

Parallel-compilation: MSBuild with make - Dependencies not called

I've got a little problem with a parallelized compilation.
I've got more than 200 projects developed with Visual Studio 2010 in a solution.
I would like to test parallelized compilation using Make in order to compare with Visual Studio compilation.
All of the structure of Makefile is correct. And I use this command for MSBuild.
msbuild.exe $(1).vcxproj -t:Build -p:Configuration=$(VS_CONFIG) -nologo -clp:NoSummary\;ShowCommandLine -p:BuildProjectReferences=false
I call make -j4 all in order to build my application but I've got the impression that Make don't build the dependencies of my projects in the Makefile.dependencies.
I've got this message :
LINK : fatal error LNK1104: cannot open file 'dependency.lib' [C:\project.vcxproj]
The dependency in question is not built during the process when the project needs it.
So, do you have an idea to resolve my problem ? Because it's really weird...
Thank you all!
I found the solution.
I have to put .PHONY in my case because targets of Makefile have the same name of directories.
Bye!