I have a few questions about Mono:
1) Is there a way to compile application for Linux without installation of Xamarin Studio?
For example i have my helloworld.cs, i use dmcs to compile it into exe. Is there another compiler or flag to compile app for linux?
2) I need to statically link Mono runtime to run on the computer without Mono installed.
There is mkbundle command but it is a very difficult process to make it work on Windows. And static linking does not work on Windows.
And besides, I need to automate these processes =/
P.S. As I said, I'm working on Windows.
1) It doesn't matter if you compile your code with the Microsoft or Mono compiler, the resulting assembly should work on all platforms (as long as you don't use any platform-specific code of course).
You can take an assembly compiled with the MS compiler and run it on Linux/Mac with Mono, or compile on Mono and run it on Windows/.NET.
2) Problems with mkbundle should probably be filed as a bug on https://bugzilla.xamarin.com
Related
My unity version is 5.3.4f, and I hava C# script as a.cs and compiled a.exe and it runs OK. Then I use IL2CPP to translate a.exe into C++ compiled exe a_il2cpp.exe with command:
il2cpp.exe --outputpath=a_il2cpp.exe --cachedirectory="obj_cache" generatedcppdir="generated_cpp" a.exe
But it shows no error and no output, do I miss something? I have C++ compiler installed.
Unity does not support using IL2CPP as a general mechanism for translating C# assemblies to native binaries. In theory this is possible (indeed some of the internal testing tools at Unity do this), but I don't think the command line you mention here will allow it to work.
I have embedded my C# DLL into my C++ application according to the documentation on http://www.mono-project.com/docs/advanced/embedding/.
On my build machine I run a different mono version than on the machine were the application is running.
I am wondering if the whole runtime is compiled into the executable or if this is just a wrapper to the installed runtime.
Is it save to use different versions of mono on the compile machine and on the runtime machine?
I want to write an iOS app in C# with Xamarin and MonoTouch. I want to use Vim and Z shell instead of Xamarin Studio. However, I can't find much documentation on how to build from the command-line.
The documentation for the mtouch command says you have to pass an assembly as an argument, but how do I create that assembly?
The command line compilers that Mono provides are mcs, gmcs, and dmcs. For Mono 2.10.x and earlier, these are for C# 1.0, C# 2.0, and C# 4.0, respectively; for Mono 3.0.x, mcs defaults to the most recent version, and you have to select earlier language/runtime versions with the -langversion and -sdk options. The dmcs and gmcs commands in 3.0.x are scripts that call mcs with the appropriate -sdk option.
I am not sufficiently familiar with Xamarin.iOS to know how the libraries are laid out, but the -lib option allows you to tell the compiler about additional directories containing .dll assemblies and -r allows you to reference a specific assembly. The compiler will build a .exe assembly by default; use -target:library or -t:library to build a .dll one instead. The -help option will give you a list of all options.
You can use whatever build system you prefer from the command line. If you need to process MSBuild project files, then xbuild can handle them, but make, cmake, scons work fine, too, and are probably preferable to editing .sln files in Vim. You may still have to figure out dependencies yourself if they aren't obvious and if you have a complex project with multiple assemblies (the compiler is fast enough that you can just recompile everything for small single-assembly projects).
Note that I am not using Mono for this myself, but primarily for command line projects on OS X/Linux, so the above may be missing some subtle details related to building mtouch-ready assemblies for iOS.
I have a rather large C# library, originally written for .NET and Windows, which we are now porting to Mono and Linux. It is thoroughly unit tested with NUnit. The porting has been fairly simple, but now I need some real debugging features, like error line numbers and breakpoints.
I'm compiling either using VS2010 on Windows 7 or with xbuild on Debian 6.0.2, it really doesn't matter because the binaries are fully compatible. Running tests with Mono 2.10.2 built from tarball, and NUnit 2.5.10 from Debian experimental.
When I run my project in Visual Studio, debugging works fine after I attach to the nunit process. So, does anyone know how I can enable fully-featured Mono debugger support with NUnit tests?
P.S. I've seen this, but I'm compiling with xbuild and running with nunit-console, so I can't manually give arguments to either the compiler or the Mono runtime.
Thanks in advance!
UPDATE: I discovered the pdb2mdb utility, but even when I use this, I still can't get line numbers, which leads me to believe that the code isn't being compiled with --debug. But since I'm using xbuild on a VS .sln file, instead of invoking the compiler directly, how do I use --debug??
Figured it out. Jon Skeet comes to the rescue, once again:
Nunit .net vs mono
After converting to mdb, I needed to run nunit-console.EXE from inside the mono command, like this:
mono --debug /opt/mono-2.10/lib/mono/4.0/nunit-console.exe Test.dll -config=Debug
That took way longer than it should have :P
Ok I am using Windows and have .Net 3.5 and the Mono 2.6 frameworks installed. I also have installed MonoDevelop and plan on using it. I just need to know if I am setup to use the Mono runtime.
All my projects have build options for Mono/Microsoft.NET 3.5, but in Edit->Prefrences->.NET Runtimes, all I see is Microsoft.NET. How do I add the Mono runtime to this list and make it default? Or do I even need to do this? I would think I would have to since our projects will be run on Linux, but not sure how to 'make sure' I am actually using Mono and not just .NET?
Mono should show up simply by virtue of being installed. You can try reinstalling Mono to see if that helps.
If not, click the "Add" button on the Edit->Preferences->.Net Runtimes page and choose where you installed Mono to, generally it will be something like:
C:\Program Files\Mono-2.6.1
If you want it to be the default, click "Set as Default" while it's highlighted and it should turn bold, indicating it is now the default. There is also a combobox on the main MD toolbar if you want a quicker way of switching between runtimes.
You shouldnt HAVE to build using Mono's compiler on Windows to have your code run on Linux.
As per answers on Performance: Compile in CS, Run in mono on windows and linux, you can compile with any compiler and run with any runtime because the compiled binary is in an Intermediate Language
You just have to be certain that your code, and the libraries that it uses, do not make operating system specific calls, P/Invoke unmanaged DLL's, or make calls to functions that are incomplete in Mono (mind you, these are getting rare)