- Mono Download Mac
- Mono C App Conversion To Mac Download
- Mono C App Conversion To Mac Free
- Mono C App Conversion To Mac Os
Download this app from Microsoft Store for Windows 10, Windows 10 Team (Surface Hub), HoloLens. See screenshots, read the latest customer reviews, and compare ratings for Pictures Opener - HEIC Supported Including Convert. Although many small apps will run on Mono unmodified, many apps will require some work on the developer’s part to run smoothly on Mono. This guide will attempt to port a non-trivial open source application to document several of the issues a developer may run into while porting their app to Mono. Using this exceptional software, C-Codes can be used to design and produce the most advanced software and games for iDevices and Android-based devices. Features of the Xamarin Collection. Use and share code written with #C on different operating systems; Very high speed conversion and code synchronization for Android and iOS.
General
Does Mono support ASP.NET?
Yes. For a more detailed view of what’s supported, see the Compatibility page.
Does Mono Support ASP?
No.
Mono does not support the old style ASP pages, it only supports ASP.NET pages; There are some tools that might help you migrate ASP pages to ASP.NET (netcoole.com).
Once you have a working ASP.NET application, you could use Mono to run it.
How can I run ASP.NET-based applications with Mono?
You can read our Guide to port ASP.NET Applications with Mono.
Additionally, this is a very good guide on porting an ASP.NET MVC WebSite to Mono is a three part series blog that covers how to port an ASP.NET MVC website application to Mono:
- Part 1: Installing the Software
- Part 2: Setting up and Configuring MySQL
- Part 3: Walk through porting the ASP.NET MVC website.
Novell: From .NET to Linux in 5 Easy Steps
You need the Mono runtime and use one of Apache with mod_mono, a CGI or FastCGI-aware web server with Mono’s FastCGI support or the xsp standalone server (all available from our downloads page).
To run ASP.NET 1.1 applications use mod-mono-server (for Apache), fastcgi-mono-server (for FastCGI servers) or xsp (for testing).
To run ASP.NET 2.0 applications use mod-mono-server2 (for Apache), fastcgi-mono-server2 (for FastCGI servers) or xsp2 (for testing)
Does Mono support ASP.NET’s web services?
Yes, Mono supports ASP.NET-based web services (files ending in .asmx)
Does Mono have support for WSE?
At this point Mono does not have support for the “Web Services Enhancements” package and there are no plans on supporting it.
See the WSE page for more details about it.
Does Mono support XHTML and Web standards?
See the long reply on WebStandards.
Are there alternatives to ASP.NET?
Some of these are not complete replacements for ASP.NET, but they might be useful for your particular domain:
- Jitsu is a framework for building web applications.
- Dream is a framework for building the backend of web applications by providing a very complete framework for building REST applications.
- Spring.NET is a port of the spring framework from Java to C#
- Maverick.NET a Model-View-Controller framework for building web applications.
The following are built on top of the basic of ASP.NET, so they are more of a complement:
- Castle Project inspired by Ruby on Rail, but this is for .NET languages
Does Mono’s ASP.NET run on Linux ?
Yes. And on all the platforms on which mono runs. In Windows you must use XSP as mod_mono does not work with the Windows version of Apache, nor with IIS.
Should I use mod_mono, FastCGI or XSP?
mod_mono will allow you to integrate Mono and ASP.NET web pages in an existing Apache installation which means that you get all the benefits that Apache has (HTTP 1.1 support, extensive configuration options, extensive documentation and support) and you can mix on a single server many other services.
FastCGI is a lightweight protocol implement by both Apache and many other web servers. It has become a universal protocol for web server extensions so it is supported by many web servers, in particular popular servers like Nginx. Configuring FastCGI is also a bit simpler for people not familiar with Apache configuration. The features are usually determined by the web server that uses FastCGI.
XSP is a very limited web server which is used typically during development or for testing. Although some people use it for production, but this server is not likely going to ever grow to support all the features that Apache or FastCGI servers have.
XSP at this point only implements HTTP 1.0 with a few extensions (keep-alive is the most important one), but no work is currently underway to support HTTP 1.1 and it is also missing features like mime-type configuration and any other features that people expect from a web server.
How do I restart my Mono applications without restarting Apache?
Enable the control panel in mod_mono, see mod_mono’s Control Panel section for details on setting it up.
My Apache Module Is Not Recognized, what to do?
In certain Apache configurations (SUSE 9.0), Apache is configured with large file support. This requires that every apache module has to be compiled with large file support as well.
You have to configure mod_mono as follows:
because mod_mono’s configure apparently doesn’t query the CFLAGS from apxs. I’ll fill a bug.
In newer versions of Mono, this is taken care of by the configure script.
mod_mono and mod_proxy
What are the advantages/disadvantages of using mod_mono with apache versus setting up apache with mod_proxy to proxy an XSP server running on a private port?
The use of mod_proxy is a common practice in the Java world with Tomcat/application serves, what is the reason not to use the same setup with XSP?
The mod_proxy approach is not recommended for Mono for the following reasons:
mod_mono:
- mod_mono performs better (it uses Unix domain sockets to communicate with the Mono server. The response headers doesn’t need to be parsed/rewritten.
- faster file transfers
- common URL namespace with Apache (if AddHandler is used)
- autohosting: AutoHosting
- enabled for mass hosting
- xsp is only an HTTP 1.0 server, with a few HTTP 1.1 extensions, but not all of them. By using mod_mono your client software is exposed to a full HTTP 1.1 implmenentation.
mod_proxy + mod_proxy_http:
- ability to run the app server under a different UID (mod_mono is supposed to support this too)
- the app server process cannot be controlled by Apache
- difficult mass hosting
How can I Run mod-mono-server as a different user?
Due to apache’s design, there is no straightforward way to start processes from inside of a apache child as a specific user. Apache’s SuExec wrapper is targeting CGI and is useless for modules.
Mod_mono provides the MonoRunXSP option. You can set it to “False” and start mod-mono-server manually as the specific user. Some tinkering with the Unix socket’s permissions might be necessary, unless MonoListenPort is used, which turns on TCP between mod_mono and mod-mono-server.
Another (very risky) way: use a setuid ‘root’ wrapper for the mono executable, inspired by the sources of Apache’s SuExec.
And finally: drop mod_mono and use mod_proxy + mod_proxy_http + XSP instead. It’s slightly easier to configure, especially if you are not used to mod_mono.
From the mono-devel-list
I get Service Unavailable
If you are getting an error like “Service Temporary Unavailable”.
Make sure that your MonoExecutablePath actually points to Mono, or simply delete the file, as it is redundant.
Common Problems
What are some common problems when porting applications?
- Place a “Bin” directory instead of “bin”
- Not placing all the required DLLs in the bin dierctory (or GAC)
- Running xsp[2], not configuring the –aplications parameter (or application in the root directory)
- Running mod-mono, not configuring the MonoApplications directive (more info with man mod_mono)
Performance is disappointing
Please consult Mod_mono for possible performance improvements.
Compilation fails with the CS0169 error message
It will happen if you configured the C# compiler in
Web.config
in a way similar to the one shown below:This is result of an incompatibility between the Microsoft .NET C# compiler and the Mono C# compiler. Please read this article for more information
ProviderException from SqliteMembershipProvider
When porting an ASP.NET app to Mono, you may get an exception similar to the following:
This is due to ASP.NET 2.0’s MembershipProvider support, which requires a backing database in order to store user account information.
The fix is easy: you need to create a
~/App_Data/aspnetdb.sqlite
SQLite database file. You can use the sqlite3 program and the SQL commands at Membership/Roles/Profile provider schema:Once you’ve created the
~/App_Data/apsnetdb.sqlite
file, restart your ASP.NET app and things should Just Work (wrt MembershipProvider, anyway).Development
I would like line numbers in my stack traces
By default xsp and xsp2 run in “release” mode, which means that no debugging information is generated at runtime. If you want line numbers in your stack traces, you must pass the –debug option to Mono, this is done by invoking xsp or xsp2 with the MONO_OPTIONS environment variable, like this:
If you are running mod_mono with Apache, you must use the MonoDebug directive in your configuration file, like this:
My application fails if I replace binaries
Current versions of Mono use the actual libraries and dlls that you might have in your bin/ directory of your application.
Although Mono will automatically pick up changes in your source code files and recompile, if you make changes to the libraries or precompiled code on a live system you might get an error as Mono will not notice this change.
This is due for the current lack of support for ShadowCopyFiles.
To work around this issue, its important that before replacing a dll in bin, you remove the file and then copy the file over. Do not copy the file over or it will fail (Unix semantics guarantee that this will work).
For example, this is the proper method of upgrading DLLs in your bin directory:
Alternatively, you can use the “install” command, which has the same effect:
The compiler takes care of this for you automatically, so you can integrate this directly into your build system:
How can I set the encoding of my files?
By default Mono will assume that the files on the file system are encoded with the encoding determined by the LANG environment variable. If you need to change the encoding, you might want to use the globalization configuration element (see “globalization Element”).
fileEncoding is the encoding of source files (.aspx, .ascx, …)
responseEncoding is the encoding of input (posted data)
responseEncoding is the encoding of output (Content-Type: …; charset)
Where are the various settings for System.Web documented?
Some documentation is available on this site on Config_system.web, but you might also use the documentation from [http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx MSDN.
Features
Does Mono support the App_Browsers folder and the .browser files?
Yes, they are supported starting from Mono version 2.0. However, there’s one difference to the .NET support. Namely, Mono does not (and cannot) distribute the standard .NET .browser files - you can, however, copy them verbatim from your .NET distribution and drop those you need in the
~/App_Browsers
directory under your application root.Does Mono support code-behind in ASP.NET?
Yes, code-behind is supported in Mono’s implementation of ASP.NET.
Be warned that this has nothing to do with the CodeBehind attribute that VS.NET adds to the pages its generates. That attribute is ignored by MS and Mono parsing code and so you need to compile and deploy the codebehind classes to the proper folder.
How can I reference an assembly in my .aspx pages?
By default, the ASP.NET engine will reference a few default assemblies and all the assemblies in the bin directory of your application.
If you want to reference any other assembly that is installed in the GAC, you can do two things, you can either list it at the top of your page:
Replacing Assembly.Name with your assembly name (i.e., “ByteFX.Data”, “Mono.Posix”, …).
Or better yet, registering this in your web.config file. If you register this on the web.config file, all the files in the current directory will be compiled with those settings:
For more details, see the Config system.web compilation page or the docs at Microsoft
How can I reference a library in my .asmx web service?
There are two kinds of libraries you can reference:
- GAC-installed assemblies
- private libraries.
To reference private libraries, just place the libraries in the “bin” directory below your application and they will be referenced automatically for you:
For GAC-installed libraries to be installed, you need to add the assembly to the Web.config file, the file should look like this:
How do I register a tag?
If you have a tag in the file MyTags.dll, this file in in bin directory or the GAC, and you want the prefix to be something, add the following to the page consuming it:
Now if there’s a control in MyTags.dll called SuperDuper you can use this in your page:
OutputCache and VarByParam
The VaryByParam=”None” semantics are not implemented in Mono, for example in:
Use a true parameter name or “*” instead.
Instead of Location=”Server”, use “ServerAndClient”.
Does Mono’s ASP.NET support SSL/TLS?
If you are using the Apache module, https support is handled directly by Apache and all the variables are available using the System.Web APIs.
I write pages that contain non-ASCII characters, and they appear garbled in the browser. What’s wrong?
Check if your aspx/ascx/etc.. files were saved in the Windows-1252 encoding, if possible, so that no further action is needed. If they are in utf-8 (default nowadays in Linux) or any other encoding you will need to tell the compiler for the language your page will be translated into to expect this other encoding. There are two forms:
1 - Change each affected page to add the specific compiler option:
2 - Change things in the machine.config (for the whole installation) or web.config (for specific web apps) files:
My Repeater/DataList/DataGrid events aren’t firing. What’s wrong?
A common error is to always databind the content in the PageLoad. If you do so for PostBacks you will be recreating the child controls from the datasource and will lose any ties to the events that are encoded in the request. Just make DataBinding conditional on the IsPostBack property not being true. That will preserve the viewstate and so the ties for the encoded event that will be fired later in the page processing.
Example:
Portability
Portability is mostly a problem when moving an existing application from Windows/.NET to Mono on non-Windows platforms.
If you are developing your application from scratch, portability problems will be kept to a minimum if you test the application regularly on both Linux and Windows during the development.
Do all ASP.NET applications run out of the box on Mono?
Not all applications written for ASP.NET work on Mono, most of the time this is due to file system assumptions that the developers made. In Unix filenames with different case are considered different, so for example it is possible to have both a “Login.aspx” and a “login.aspx” file. If programmers are not consistent in their file naming practices applications will not run.
These are a few common problems:
- The files on the ASP.NET application are themselves are camel-cased, like “Login.aspx” but the pages on the site are hard coded to reference “login.aspx”.
- The application uses the Registry to store settings (Mono implements a emulated registry on Unix that takes some configuration to setup).
- The application makes use of a library not provided in Mono (EnterpriseServices for example).
Porting an application typically requires those changes to be made.
Does <app> run on Mono?
Most applications will run on mono without a hassle, but others will need to be audited for the problems stated above in this section.
Some applications already include direct support for Mono, like nGallery.
Does Mono support ASP.NET AJAX?
Yes, Mono versions after 1.9 do support ASP.NET AJAX.
Are there other AJAX frameworks that could be used with Mono?
There are a few Ajax libraries that developers could consider:
- Anthem.NET library.
- Magic Ajax.NET.
- GaiaWidgets
Is it possible to have different ASP.NET configuration for different operating systems without separate configuration files?
Yes, it is possible with Mono version from git master or 1.2.7 or newer. This is a Mono-specific feature which allows you to change various configuration settings on the application run time without the neeed to ship a separate set of configuration files for each supported operating system. If you plan to run your application on MS.NET/IIS and Mono, then you should configure it for the Windows/MS.NET target and provide configuration settings mappers for other operating systems. For more information see ASP.NET_Settings_Mapping
Extra Languages
How can I use F# with ASP.NET on Mono?
Out of the box, ASP.NET only supports pages written in C# and VB.NET. To convince it to use the F# compiler, the following extra steps are required:
- Install the F# compiler and runtime.
- Set up mod_mono for apache, clx, or whichever web server you want, set up your ASP.NET page and configure the web-server to find it.
- Copy the FSharp.Compiler.CodeDom.dll file from the bin directory of your FSharp installation to the bin directory of your ASP.NET page.
- The web.conf for your page should look something like this to enable the compiling of F# code:
Note that you might have to adjust the version numbers mentioned. There are example files for this in the samples/fsharp/Web/ASP.NET/, but for me they wouldn’t work out of the box.
- Make sure there is a file fsc.exe somewhere in your path that invokes the F# compiler. Since, on Unix, you can not directly run the .exe files, create a shell script named “fcs.exe” with this content:
Now your ASP.NET page should load.
(thanks to Marijn Haverbeke for the contribution)
Using Mono with Apache
Will you support Apache 1?
Yes, the mod_mono module works on both major versions of Apache (1.x and 2.x)
Can I run Apache 1 and Apache 2 on the same machine?
You can always keep a copy of Apache 2 running in parallel with your Apache 1.3 (either different port or using a reverse proxy). You can also bind the two servers to different IP addresses on the same physical machine.
How do I register a new extension to be processed by mod_mono?
Consider for example turning .htm files into files processed as .aspx files.
You need to add to your Apache configuration the following line:
And you need to inform the ASP.NET runtime how to handle the pages, add this to your web.config file:
You also need to inform System.Web about the .htm extension being now a page:
web.config, inside system.web and inside httpHandlers:
(thanks to Marijn Haverbeke, for this contribution)
How do I setup multiple virtual hosts?
Joe Audette has a tutorial here
Memory Usage
Why does the memory consumed by the Mono process keep growing?
In the past, Mono used a conservative, non-moving, non-compacting garbage collector. This meant that the heap was not compacted when memory was released.
It now uses a new collector, see the Generational GC page.
by Jonathan Pobst
The amount of effort required to get an existing Winforms app running on Mono can vary greatly. Although many small apps will run on Mono unmodified, many apps will require some work on the developer’s part to run smoothly on Mono. This guide will attempt to port a non-trivial open source application to document several of the issues a developer may run into while porting their app to Mono.
The Project
For this guide, the open source application NClass has been chosen. It is a UML compliant class designer that looks very much like the one that ships in Visual Studio 2005. It is licensed under the GPL and LGPL, and has not been written with Mono in mind. We will be using Mono 1.2.4 to port NClass to run on Linux.
- NClass homepage - http://nclass.sourceforge.net/index.html
- NClass download - http://nclass.sourceforge.net/downloads.html (this guide uses the “source” version)
NClass running on .Net with included example file:
Getting Started
For the purpose of this guide, we will make the assumption that the developer is more familiar with Windows and Visual Studio than the Linux counterparts, given that the app is originally a Windows app.
Because we grabbed the source version, first we need to load up NClass.sln in Visual Studio and compile the solution.
Once we have a compiled executable, we can run MoMA on it to give us an idea of what kinds of issues we may run into.
The results from the MoMA scan can be seen here.
MoMA Summary
Methods we are using that are not in Mono 1.2.4:
- void ListView.add_ItemSelectionChanged (ListViewItemSelectionChangedEventHandler)
- void TreeView.set_ShowNodeToolTips (bool)
- void TreeNode.set_ToolTipText (string)
- void PrintDialog.set_UseEXDialog (bool)
Methods that are marked with a [MonoTODO] attribute in Mono.1.2.4:
- void Control.set_AutoSize (bool) - This method currently does nothing
- void ContainerControl.set_AutoScaleMode (AutoScaleMode) - Call scaling method
- void ComboBox.set_AutoCompleteMode (AutoCompleteMode) - AutoCompletion algorithm is currently not implemented.
- void ComboBox.set_AutoCompleteSource (AutoCompleteSource) - AutoCompletion algorithm is currently not implemented.
Looking at the report, we can immediately see several places we will most likely need to make adjustments for our program to work.
The TODOs look pretty harmless, we can infer that if we rely on AutoSize, it’s probably not going to work, and we are not going to have auto completion for our ComboBox. Most of these missing methods won’t be too big of a problem either once we work around them. We can expect that we will not have ToolTips in our TreeView, and we can’t set our PrintDialog to use the Windows XP dialog. The missing event ListView.ItemSelectionChanged however will likely be a problem. Because that event does not exist, it will not get fired, so whatever code we are doing in the event handler will not get called.
Trying It Out
Even though MoMA shows there could be problems running the application, sometimes those problems aren’t hit until certain features of the program are executed. So let’s try to run the application.
Open “Mono-1.2.4 Command Prompt” that was created in the start menu by the Mono installer. Go to the directory that contains the executable “NClass.NClass.exe”, and try running it with Mono using:
Unfortunately, nothing seemed to happen.
What actually happened is that the application ran, but hit an error and quit. To see the error, we need to redirect the error output to a file, so we run:
Looking at the log that was created, we see this error:
This isn’t really unexpected. It is telling us that we tried to set the property PrintDialog.UseEXDialog, which MoMA already told us didn’t exist in Mono. So it’s time to start porting our source code to work around these issues.
Porting Strategies
There are several approaches to porting code, depending on your goals.
Mono Download Mac
- The unsupported code can simply be removed or commented out if it is not needed.
- Compiler conditional directives (#if) can be used to create separate executables for .Net and Mono.
- The runtime (.Net or Mono) can be detected and use different code.
- The code can be rewritten to use supported methods in Mono.
Here is the section of code that is setting PrintDialog.UseEXDialog in MainForm.Designer.cs:
Remove / Comment Code
If the code isn’t really needed, the easiest thing to do is to remove it:
or comment it out:
However, there will be plenty of cases when this is not feasible.
Compiler Conditionals
Another strategy is to create different assemblies for .Net and Mono. This can be done by wrapping all code that is not supported by Mono in conditional directives and compiling with and without the directive.
When compiling the version for Mono, we would specify the flag MONO in the Build tab of the GUI project properties.
The downside of this approach is that we must ship separate assemblies for different platforms.
![Mono Mono](/uploads/1/2/6/4/126448388/140667221.jpg)
Runtime Conditionals
In order to have only one assembly for all platforms, but run different code on different platforms, we can detect at runtime whether we are using Mono or .Net. First, create a function to detect if the assembly is running on Mono (from the Technical FAQ):
Then use the function to determine which code to run:
Notice that we moved the code into a separate function, as this will prevent the JIT engine from throwing an exception as it JITs the code and determines that the method did not exist. By moving the code into a different method we prevent the JIT engine from hitting it.
Rewriting Code
Sometimes the best option is to simply rewrite the problem code in a way that is supported by Mono. For example, MoMA told us that this application uses the ListView.ItemSelectionChanged event, which is not implemented in Mono. However, the event ListView.SelectedIndexChanged event is implemented, and could be used for the same purpose.
Here is the problem code:
Which can be modified to:
We then modify lstItems_ItemSelectionChanged from:
To:
When possible (which isn’t always the case), this method is the cleanest, as it uses the same code and provides the same functionality on both the Mono and .Net runtime.
Porting NClass
For our NClass application, we will comment out PrintDialog.UseEXDialog, TreeView.ShowNodeToolTips, and TreeNode.ToolTipText. We will rewrite both occurrences of ListView.ItemSelectionChanged.
MainForm.Designer.cs - Line 1196
TreeDialog.Designer.cs - Line 66
TreeDialog.cs - Line 74
MembersDialog.designer.cs - Line 238
Rewriting the listMembers_ItemSelectionChanged method takes a little bit more effort. One way is to change it from:
To:
Also, make the changes to lstItems.ItemSelectionChanged and lstItems_ItemSelectionChanged outlined in the “Rewriting Code” section above.
With these changes made, rebuild the solution in Visual Studio. Then run the NClass.NClass.exe executable again. This time we get much better results:
Loading up the example file:
Class members dialog:
Continuing the Port
Now that the application runs, you have a good starting point to work from. However, it needs to be thoroughly tested for issues that MoMA can’t find. When exercising the application’s code, it is possible that you will run into things that do not function as expected or the application may crash unexpectedly. If these issues are bugs in Mono, please file the bug with a small test case (not your entire application) so we can fix them. See Bugs for details. Other issues may just be poorly written code that can be fixed by rewriting it to be more robust and error-proof.
There are still many issues with the NClass port, but for the sake of brevity, we will not attempt to fix them in this guide.
Running on Linux
Ultimately, the goal is to run the application on Linux, so let’s look at running NClass on Linux. If you already have a Linux installation, you can look for Mono packages in your distro’s package repositories.
If they are not there or are out of date, there are packages for many popular distros on Mono’s Downloads page. If you cannot find pre-made packages, you can also compile from the source code. Instructions are available here.
If you do not have a Linux installation, another option is to run the openSUSE/Mono VMWare image. This is the method we will use, which requires the following:
- Free VMWare Player - http://www.vmware.com/products/player/
- Mono 1.2.4 on openSUSE 10.2 VMWare image - Downloads
After installing the VMWare player and unzipping the VMWare image, start the Mono image. It should bring you to the openSUSE desktop:
Enabling User Shares
To transfer the application to the Mono image, we need to create a NClass directory and turn on directory sharing.
- Right click the desktop, choose Create Directory, name the directory NClass.
- Click the “Computer” menu in the bottom left, choose Control Center.
- Choose “YaST” at the bottom, the password is “mono”.
- Choose “Network Services”, then “Samba Server”.
- Check “Allow Users to Share Their Directories” on the “Shares” tab.
- Choose “Finish”.
- Back on the desktop, Right click the “NClass” folder you created and choose “Sharing Options”.
- Check “Share this folder” and “Allow other people to write to this folder”.
- Click “Modify Share”.
Now go back to Windows, and access your new share by typing “mononclass” into the Run dialog. Copy your NClass project to the Mono image share.
Mono C App Conversion To Mac Download
On the Mono image desktop, double click your NClass folder, and navigate to your compiled NClass.NClass.exe application. Double click it and the application should run.
Linux Platform Differences
There are two classes of issues you may run into during your port. The first class are issues stemming from differences between the .Net and Mono runtime. These can be worked out while still on Windows as shown above. However, there is a second class of issues that you may come across. These are issues stemming from differences between Windows and Linux (or macOS, etc.).
Common OS Porting Issues
- Use of Win32 P/Invokes
- Case sensitivity in file names.
- Use of “” in paths.
As an example, lets say you have a subdirectory in your application called “Sounds” that contains the file “Finished.wav”. To play this sound, you have the following function:
This function exhibits all three mentioned porting issues.
Mono has a special execution mode that will help you get your port moving faster (if you do not want to change the filename casing or path separators, see the IOMap page for details.
Win32 P/Invokes
The PlaySound function is declared in the Win32 API dll “winmm.dll”, which does not exist on Linux. There are two ways around this. One is to find the equivalent function in your target platform’s API, and use runtime detection to determine which API to call. If you are lucky, the easy way is to replace your API call with managed code. In this case, we can use the System.Media.SoundPlayer class to play the sound for us, like this:
Case Sensitivity
Another difference between Windows and many other operating systems such as Linux is that the file system is case sensitive. That is, in Windows the files “readme.txt” and “README.TXT” are the same, but in Linux those are distinct files. Looking at our example, our file is called “Finished.wav”, but we are referencing it in code as “finished.wav”. Although this will work on Windows, it will generate a FileNotFoundException on Linux. So we must be consistent about the case of our file names:
The Path Separator
Another issue you may run across is the path separator (“”) used in file paths. In many other operating systems, such as Linux, the path separator is a forward slash (“/”) instead of a backwards slash like Windows. In our example, we have hard coded a backwards slash that will cause our file to not be found.
We can correct this using Path.DirectorySeparatorChar:
or using Path.Combine:
Either method will ensure that the correct path separator is used on the correct operating system.
For some more issues you might run into and a more detailed look at options for dealing with them, see Guidelines:Application Portability.
Mono C App Conversion To Mac Free
Conclusion
Using this guide, we have managed to port a non-trivial winforms app to start up on Mono on Linux in a couple of hours. Although it is not complete, once the application is starting up on Mono, it’s a good beginning to test and see what issues remain.
Advanced Guides
Mono C App Conversion To Mac Os
- Guide: Debugging With MWF - Shows how to use the MWF project file from git to debug issues.