What's the best way to build a c# solution made with Visual Studio on Ubuntu? Is there a way to convert the .sln file to a makefile? Should I use Mono?
The first thing I would do would be to use Moma to check to see if your program will run under Mono as is. You can also use MonoDevelop which can use Visual Studio Projects.
From their faq: In fact, since MonoDevelop 2.0 the default project format has been VS2008-style MSBuild projects, but VS2005 and VS2010 formats are also handled.
C# is a .NET language, .NET is a Windows-based framework. It has been ported to Linux operating systems (Ubuntu included) via the Mono Project. So yes, you need to use Mono.
Mono is the best I've tried. It says on their homepage that they are binary compatible between each other, so if it's already built, you could just run it on Mono. No need to recompile.
Your best bet is to use Mono if you want to use a process like MsBuild. Mono has xBuild that is similar. This SO question has some information about using Mono.
Related
I have an application that uses a third party DLL. Is there a way in Visual Studio for Mac to write an application to access it the same way as I can on windows?
It depends:
Managed .NET DLL:
Can be imported and used the same way as in VS on Windows
Native DLL: can't be used directly. You'll need to build it for your target system, OSX in your case.
If you have C/C++ code you should be able to build it for OSX (with GCC for example) if it doesn't have some foreign (Windows) platform specific code. Then you can use the compiled *.so / *.dylib file directly. But you'll need to tell the .NET Runtime (Mono for example on OSX) to use the different file using a DllMap configuration file (see http://www.mono-project.com/docs/advanced/pinvoke/dllmap/ for examples).
The sources you've linked look like they're for Unix, so the chance to be able to build them on OSX are pretty good (there's a Makefile and the resulting binary would be libswe.so on Unix). You could try to pass the -dynamiclib parameter to GCC to get a OSX specific libswe.dylib (What are the differences between .so and .dylib on osx? seems to be a good answer about dylib)
If you have the binary of your DLL for OSX, you just need a configuration file for your .NET application, which could look like this:
<configuration>
<dllmap os="osx" dll="libswe.dll" target="libswe.dylib"/>
<configuration/>
It tells the .NET Runtime to import the symbols from libswe.dylib instead of libswe.dll if the current OS is OSX.
No.
Although you might think that because you have an IDE with the same name as the Windows counterpart the binaries it produces are not transferable.
An answer on Super User gives some more information:
There's no real DLLs in OS X, Linux, or any POSIX for that matter.
They don't make the differentiation.
Why?
A lot of Mac stuff, for one, is self-contained (.app's are really just
folders after all).
Although...
Another queston on SO asks the same thing, and an answer says:
Finally Microsoft released .NET Core which is completely platform
independent.
... now .NET applications can be developed on Mac or Linux machine
using the lightweight IDE Visual Studio Code and Visual Studio for Mac
IDE has been released where Mono on MacOS X is integrated.
So if the supplier of the library (DLL) you want to use has created a version of it with the .NET Core framework, you might be in luck.
for strict constrains in my scenarios, I have very few room to install my application, and .net framework is not installable (any version).
If the application is really simple (more or less), it is possible to create an application in visual studio (in c#) with no dependendency from the .net framework?
Thanks!
Short answer: NO.
There is no way to create a .NET application without any framework.
It is possible to compile a C# app such that it has no dependencies on any of the built-in .NET types & libraries, by using the /nostdlib switch (see http://msdn.microsoft.com/en-us/library/fa13yay7.aspx). You then need to supply your own System namespace.
However, this doesn't remove the need for the .NET framework on the target machine if you use the standard C# compiler. As well as containing the built-in types, the framework also includes the JIT IL compiler, the CLR extra, which all .NET executables and dll's are reliant on.
There are ways of compiling C# code such that it doesn't need the framework though. The Xamarin product for example (http://xamarin.com/), supports compiling C# code to native iOS apps, which are wholely independent of the .NET framework. I'm not aware of any equivalent for "desktop" OS's though.
Writing, compiling and running a C# program without .Net means running a special C# compiler that produces native code instead of managed code. I think such a compiler exists from WinRT for mobile phones, which uses COM instead of .Net (And C++/CX instead of C++/CLI). Code it produces does not depend on the .Net Framework, but does depend on the WinRT runtime.
You may create mono GTK# application and then use mkbundle to generate independent executable. You can use Visual Studio to build your logic and use Xamarin studio to build GTK# GUI. For more information about mkbundle see this and this.
To reply to your query. It really is not possible to create a .Net application without the .Net frame work. And moreover if you have installed Visual Studio by default it would have asked you to install .Net framework or would have installed it by default. In that scenario there is already .Net framework installed in your PC.
Thanks
I'm porting a C# application which is completely written in windows under Visual studio which did all the nice bits for me. Now I'm finding it difficult to be able to run it under Linux with mono. I'm using a few libraries in it which I included but I'm unable to use NLog which I dont find any native version for debian-squeeze. How should I link Nlog into my project and also the config file for it?
p.s : I'm compiling under debian-squeeze x64.
Have a look here.
There is a problem with the latest NLog release - check if you can use NLog 1.0.
In general this article explains how you could install the NLog assembly for your program when you copy the compiled dll from your Windows machince to your Debian box.
Since I was not satisfied with my C# application not working on Linux or Mac, I installed MonoDevelop in hopes of porting my application to Mono for cross-platformability.
However, I don't know how how to use MonoDevelop to accomplish this task. There's no instructions in FAQ or Documentation.
Any idea how to do it?
From MonoDevelop FAQ:
Can I import my Visual Studio 2K5+ project into MonoDevelop?
MonoDevelop can open, manipulate and save MSBuild-based projects
directly in most cases. In fact, since MonoDevelop 2.0 the default
project format has been VS2008-style MSBuild projects, but VS2005 and
VS2010 formats are also handled.
Google is still your friend:
How to port your .Net applications to Linux using Mono tools for Visual Studio
Using Mono to port a C# .NET app to OS X?
Is there a version of Monodevelop that runs on Windows? If so where can I get it?
MonoDevelop officially supports Windows since 2.2. You can check the what's new in Monodevelop 2.2 or download the last release.
Windows Support
Windows now Officially Supported
Windows is now an officially supported
platform for running MonoDevelop. Many
Windows specific issues have been
fixed, and some add-ins such as
debugging and subversion support have
been written specifically for Windows.
Windows Installer
We are releasing a new Windows
Installer which includes almost all
you need to run MonoDevelop. The only
external dependency is gtk#, which is
provided in a separate installer.
It looks like you can build it and run it on Windows, but I don't think there is a binary download available yet. From the docs, here:
Does MonoDevelop work on Windows?
Yes. MonoDevelop can be built and run
on Mono on Windows, although it is
still unstable and some features may
not be available. We are currently
working on a Windows installer that
will be soon be available.
There are no precompiled binaries, so you'd have to build from source. Even then, there seems to be some stability issues running MonoDevelop on Windows (see here).
Some alternatives would be SharpDevelop and/or Visual Studio Express.
Update: MonoDevelop version 2.2 and higher officially supports Windows. You can get the latest version here: http://monodevelop.com/Download
There is currently no official release of Monodevelop for windows. After researching it a little bit, it seems that MonoDevelop was started as a port of SharpDevelop which is an open source .Net IDE for windows. Perhaps you may want to look into SharpDevelop and see if it meets your needs.
You can find out more information at the SharpDevelop website:
http://www.icsharpcode.net/OpenSource/SD/
You can specifically target the Mono framework when writing apps in SharpDevelop (something you can't do with Visual Studio Express). I should have pointed this out in my answer above. From the website:
SharpDevelop has the ability to
compile your code against previous
versions of Microsoft's .NET
Framework, Microsoft's Compact
Framework or Mono (an open source
implementation of the .NET Framework
sponsored by Novell) if they are
installed.
The easiest way now to get MonoDevelop is running openSUSE Linux under VirtualBox. It's really no so hard. You will get "real" linux system with Mono & MonoDevelop running on it without any issues. Hope this helps.
There is not currently binaries available for MonoDevelop for Windows. This is because it has not been tested and is extremely buggy. Ie: you will probably not get more a minute or two of use before it crashes. Hopefully with MD 2.0 now out, this is something we will soon have time to address.
Note that you do not need MonoDevelop to use Mono. You can use the same binaries produced from Visual Studio or SharpDevelop on Mono.