Search
User login
How to run a C# and WPF application on the Mac?
Since C# is based on a virtual machine system, much like Java, many have wondered whether their WPF-based C# applications can be easily ported to the Mac.
Unfortunately, this is no easy task. If your application is command line-based, this may be possible. Check out Mono, a CLR emulator for Linux and Mac. However, no one has yet created a wrapper for the WPF library, and so this part is not so easy.
The Solution
With all of that said, there is a way to do it! Instead of using WPF, use Silverlight, the lean and mean cousin of WPF. Silverlight will run in a browser on the Mac.
As luck would have it, Silverlight 3 now supports running a Silverlight app outside of the browser as a desktop application. To enable this, simply do the following:
- Open your AppManifest.xml file and paste in the code below. (This assumes your application happens to be called "MyAppName") -- you will need to replace this with the real name of your application.
- Now simply run your application in a browser. Then right-click on the app in the browser and choose "Install MyAppName onto this Computer..." and follow the onscreen steps.
- That's it!
| <Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| EntryPointAssembly="MyAppName" |
| EntryPointType="MyAppName.App"> |
| <Deployment.Parts> |
| </Deployment.Parts> |
| <Deployment.OutOfBrowserSettings> |
| <OutOfBrowserSettings |
| ShortName="MyAppName"> |
| <OutOfBrowserSettings.WindowSettings> |
| <WindowSettings Title="Offline MyAppName" /> |
| </OutOfBrowserSettings.WindowSettings> |
| <OutOfBrowserSettings.Blurb> |
| Allows working offline |
| </OutOfBrowserSettings.Blurb> |
| </OutOfBrowserSettings> |
| </Deployment.OutOfBrowserSettings> |
| </Deployment> |