<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Jon Galloway : Mono</title><link>http://weblogs.asp.net/jgalloway/archive/tags/Mono/default.aspx</link><description>Tags: Mono</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Getting Mono compiler output in a web application using StreamReportPrinter</title><link>http://weblogs.asp.net/jgalloway/archive/2011/06/02/getting-mono-compiler-output-in-a-web-application-using-streamreportprinter.aspx</link><pubDate>Thu, 02 Jun 2011 23:06:47 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7813630</guid><dc:creator>Jon Galloway</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/jgalloway/rsscomments.aspx?PostID=7813630</wfw:commentRss><comments>http://weblogs.asp.net/jgalloway/archive/2011/06/02/getting-mono-compiler-output-in-a-web-application-using-streamreportprinter.aspx#comments</comments><description>&lt;p&gt;I've been continuing my experiment with Mono's compiler as a service in an ASP.NET MVC application and making pretty good progress. One of the difficulties I ran into along the way was in troubleshooting compiler errors when I'd deployed the application. Almost all of the content and documentation on Mono.CSharp is in a console application / REPL scenario, which doesn't help in tracking down errors in a web application.&lt;/p&gt;  &lt;p&gt;To recap from before, most of the samples you'll see for using Mono.CSharp look like this (undoubtedly copied from &lt;a href="http://tirania.org/blog/archive/2011/Feb-24.html"&gt;Miguel's blog&lt;/a&gt;):&lt;/p&gt;  &lt;pre class="brush: csharp; auto-links: false;"&gt;var report = new Report(new ConsoleReportPrinter());
var evaluator = new Evaluator(new CompilerSettings(), report);
evaluator.Run(&amp;quot;DateTime.Now&amp;quot;);&lt;/pre&gt;

&lt;p&gt;The problem is that the ConsoleReportPrinter writes to Console output, which isn't doing me any good.&lt;/p&gt;

&lt;pre class="brush: csharp; auto-links: false;"&gt;// Mono.CSharp.ConsoleReportPrinter
public override void Print(AbstractMessage msg)
{
    base.Print(msg);
    if (base.Stacktrace)
    {
        Console.WriteLine(ConsoleReportPrinter.FriendlyStackTrace(new StackTrace(true)));
    }
}&lt;/pre&gt;

&lt;p&gt;ConsoleReportPrinter's base is StreamReportPrinter, though, and that works just fine with a StringWriter, like this:&lt;/p&gt;

&lt;pre class="brush: csharp; auto-links: false;"&gt;var reportWriter = new StringWriter();
try
{
    var report = new Report(new StreamReportPrinter(reportWriter));
    var evaluator = new Evaluator(new CompilerSettings(), report);

    evaluator.Run(&amp;quot;using System.ComponentModel.DataAnnotations;&amp;quot;);
    evaluator.Run(modelDefinition);

    object model = evaluator.Evaluate(&amp;quot;new Monkey();&amp;quot;);
    return View(model);
}
catch
{
    string result = reportWriter.ToString();
    return Content(result);
}&lt;/pre&gt;

&lt;p&gt;Running this gives some useful output, indicating the compilation results:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;{interactive}(1,30): error CS0234: The type or namespace name `DataAnnotations' does not exist in the namespace `System.ComponentModel'. Are you missing an assembly reference? {interactive}(1,30): error CS0234: The type or namespace name `DataAnnotations' does not exist in the namespace `System.ComponentModel'. Are you missing an assembly reference? {interactive}(1,6): error CS0246: The type or namespace name `Monkey' could not be found. Are you missing a using directive or an assembly reference?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now that we've got the results as a string, they can be logged or handled appropriately.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7813630" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/jgalloway/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/jgalloway/archive/tags/Mono/default.aspx">Mono</category><category domain="http://weblogs.asp.net/jgalloway/archive/tags/ASP.NET+MVC/default.aspx">ASP.NET MVC</category></item><item><title>Dynamic ASP.NET MVC 3 models using Mono’s Compiler as a Service</title><link>http://weblogs.asp.net/jgalloway/archive/2011/05/26/dynamic-asp-net-mvc-3-models-using-mono-s-compiler-as-a-service.aspx</link><pubDate>Fri, 27 May 2011 00:50:52 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7804986</guid><dc:creator>Jon Galloway</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/jgalloway/rsscomments.aspx?PostID=7804986</wfw:commentRss><comments>http://weblogs.asp.net/jgalloway/archive/2011/05/26/dynamic-asp-net-mvc-3-models-using-mono-s-compiler-as-a-service.aspx#comments</comments><description>&lt;p&gt;I had an idea for an interactive MVC sample which will let you see the scaffolded editor and display for a model. I thought about a few ways to do this, the first being Mono’s compiler as a service. So far it’s a partial success – the model scaffolding works, but the attributes don’t (very possibly my mistake).&lt;/p&gt;  &lt;h2&gt;Getting the latest Mono Compiler&lt;/h2&gt;  &lt;p&gt;Miguel recommended that I grab the latest Mono build off Github, since there have been some improvements and bug fixes in the compiler. He wasn’t kidding, there’s a lot of active work going on in the compiler, and the Evaluator class (the main compiler service class) is no exception. Here’s the commit history just for the Evaluator (eval.cs):&lt;/p&gt;  &lt;p&gt;&lt;a title="https://github.com/mono/mono/commits/871ad48b98346cffc194b6ebe458a93d88dba009/mcs/mcs/eval.cs" href="https://github.com/mono/mono/commits/871ad48b98346cffc194b6ebe458a93d88dba009/mcs/mcs/eval.cs"&gt;https://github.com/mono/mono/commits/871ad48b98346cffc194b6ebe458a93d88dba009/mcs/mcs/eval.cs&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;A quick skim of the mcs (mono csharp compiler) commit messages in general shows a lot of work going on, including work on async: &lt;a title="https://github.com/mono/mono/tree/master/mcs/mcs" href="https://github.com/mono/mono/tree/master/mcs/mcs"&gt;https://github.com/mono/mono/tree/master/mcs/mcs&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The biggest change since the last Mono release, as &lt;a href="http://tirania.org/blog/archive/2011/Feb-24.html"&gt;Miguel blogged about in February&lt;/a&gt;, is the change from static API to an instance API:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;…we turned the static API Evalutor.Eval (string expression), into an instance API. The instance API allows developers that are embedding the C# compiler-as-a-service in their application to have different contexts. &lt;/p&gt;    &lt;p&gt;This required the entire compiler to be updated from being a giant set of static classes that could safely use global variables and state into a state that was properly encapsulated. &lt;/p&gt;    &lt;p&gt;The API is now richer, we provide a way to configure the compiler settings using a settings class. This can be populated either manually, or by using the build-in command-line parser for compiler options.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This is good news – I find the new API easier to work with. The magical static stateful service API pattern works great for the REPL sample but causes problems if you’re doing anything much more complex. The downside, though, is that just about all the code samples and blog posts on the the Mono compiler service stuff don’t work as-is against the new compiler.&lt;/p&gt;  &lt;p&gt;I didn’t want to set up a build environment for Mono. Fortunately, most established open source projects offer regular builds if you look around a bit. I grabbed the most recent MonoCharge package from &lt;a title="http://mono.ximian.com/daily/" href="http://mono.ximian.com/daily/"&gt;http://mono.ximian.com/daily/&lt;/a&gt;, which includes all the precompiled binaries. They’re packaged as a .tar.gz, which opens up just fine in &lt;a href="http://7-zip.org/"&gt;7-zip&lt;/a&gt;. I just grabbed the Mono.CSharp.dll assembly.&lt;/p&gt;  &lt;p&gt;&lt;a title="2011-05-20 22h14_44" href="http://www.flickr.com/photos/36836555@N00/5741600327/"&gt;&lt;img border="0" alt="2011-05-20 22h14_44" src="http://static.flickr.com/5106/5741600327_140bae7f06.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Using the Mono Compiler Service in an application&lt;/h2&gt;  &lt;p&gt;It’s pretty easy to put use the compiler in an app:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Reference Mono.CSharp.dll &lt;/li&gt;    &lt;li&gt;Add a using statement for Mono.CSharp &lt;/li&gt;    &lt;li&gt;New up an Evaluator and get to work: &lt;/li&gt; &lt;/ol&gt;  &lt;pre class="brush: csharp;"&gt;var report = new Report(new ConsoleReportPrinter());
var evaluator = new Evaluator(new CompilerSettings(), report);
evaluator.Run(&amp;quot;DateTime.Now&amp;quot;);&lt;/pre&gt;

&lt;p&gt;The evaluator constructor requires a ConsoleReportPrinter and CompilerSettings, neither of which we care about, so we’re just passing them in to make everyone happy. Are you happy? Me, too. Onward!&lt;/p&gt;

&lt;h2&gt;Using Mono Compiler in an ASP.NET MVC Application&lt;/h2&gt;

&lt;p&gt;ASP.NET MVC 3 views are typed as ViewPage&amp;lt;dynamic&amp;gt; and the Html.EditorForModel scaffolding stuff works via reflection, so theoretically we could create a new model on the fly and lob it over to the view and things should just work, right? Let’s see.&lt;/p&gt;

&lt;p&gt;First, we’ll create the controller that builds a dynamic class. I’m throwing in a property with a dynamic name just to make it clear that this entire model is coming from a string.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;using System.IO;
using System.Reflection;
using System.Web.Mvc;
using Mono.CSharp;
using System;

namespace DynamicModelCompilation.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            string modelDefinition =
            @&amp;quot;
              public class Monkey
              {
                    public string Name { get; set; }
                    public string Password { get; set; }
                    public bool IsHappy { get; set; }
                    public bool GetsDownOn&amp;quot; 
                        + DateTime.Now.DayOfWeek + 
                    @&amp;quot; { get; set; }
                }
            &amp;quot;;

            var report = new Report(new ConsoleReportPrinter());
            var evaluator = new Evaluator(new CompilerSettings(), report);
            evaluator.Run(modelDefinition);
            dynamic model = evaluator.Evaluate(&amp;quot;new Monkey();&amp;quot;);

            return View(model);
        }
    }
}&lt;/pre&gt;

&lt;p&gt;The above code:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Builds a string which we’ll be passing to the compiler &lt;/li&gt;

  &lt;li&gt;Creates a compiler (as we saw earlier) &lt;/li&gt;

  &lt;li&gt;Calls &lt;a href="http://docs.go-mono.com/Mono.CSharp.Evaluator.Run%20(string)"&gt;Evaluator.Run&lt;/a&gt;, which executes the code string passed to it &lt;/li&gt;

  &lt;li&gt;Calls &lt;a href="http://docs.go-mono.com/Mono.CSharp.Evaluator.Evaluate%20(string)"&gt;Evaluator.Evaluate&lt;/a&gt; on “new Monkey()” which news up an instance of our model and returns it &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Next, we’ll set up a simple Index view that displays an editor template for based on whatever model object is passed to it:&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;@{
    ViewBag.Title = &amp;quot;Home Page&amp;quot;;
}
&amp;lt;script src=&amp;quot;@Url.Content(&amp;quot;~/Scripts/jquery.validate.min.js&amp;quot;)&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src=&amp;quot;@Url.Content(&amp;quot;~/Scripts/jquery.validate.unobtrusive.min.js&amp;quot;)&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true, &amp;quot;Account creation was unsuccessful. Please correct the errors and try again.&amp;quot;)

    &amp;lt;fieldset&amp;gt;
        @Html.EditorForModel()
    &amp;lt;/fieldset&amp;gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;Processinate Form&amp;quot; /&amp;gt;
}&lt;/pre&gt;

&lt;p&gt;Running the application show that our nefarious plan has succeeded:&lt;/p&gt;

&lt;p&gt;&lt;a title="2011-05-21 01h51_12" href="http://www.flickr.com/photos/36836555@N00/5741965643/"&gt;&lt;img border="0" alt="2011-05-21 01h51_12" src="http://static.flickr.com/3565/5741965643_8ac86d2ff3.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pushing Our Luck – Trying Out Some Attributes&lt;/p&gt;

&lt;p&gt;A lot of the goodness in the MVC templates comes from the way the helpers work with data annotations. You can set display names for properties (e.g. changing the display label for IsHappy to &amp;quot;Is this monkey happy?&amp;quot;), setting validation requirements for edit forms, etc. I took a shot at adding those in to the model class.&lt;/p&gt;

&lt;p&gt;First off, I needed to include a reference to the System.ComponentModel.DataAnnotations assembly in my Mono Evaluator session. That's easy enough to do with a call to LoadAssembly, presuming you have the full path to the assembly. I copied System.ComponentModel.DataAnnotations to my /lib file and referenced it like this:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;System.Uri uri = new System.Uri(Assembly.GetExecutingAssembly().CodeBase);
string path = Path.GetDirectoryName(uri.LocalPath).Replace(&amp;quot;\\DynamicModelCompilation\\bin&amp;quot;, &amp;quot;\\lib&amp;quot;);
evaluator.LoadAssembly(Path.Combine(path, &amp;quot;System.ComponentModel.DataAnnotations.dll&amp;quot;));&lt;/pre&gt;

&lt;p&gt;That adds the reference to the compiler session, but you still need to run a using statement, like this:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;evaluator.Run(&amp;quot;using System.ComponentModel.DataAnnotations;&amp;quot;);&lt;/pre&gt;

&lt;p&gt;Finally, I added some annotations to my model:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public class Monkey
{
	[Required]
	[StringLength(3, ErrorMessage = &amp;quot;&amp;quot;The {0} must be at least {2} characters long.&amp;quot;&amp;quot;, MinimumLength = 1)]
	public string Name { get; set; }

	[Required]
	[DataType(DataType.Password)]
	public string Password { get; set; }
	
	[Display(Name = &amp;quot;&amp;quot;Is this monkey happy?&amp;quot;&amp;quot;)]
	public bool IsHappy { get; set; }
}&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Note: if you get any of those things wrong, you get a slightly cryptic exception on your call to evaluator.Evaluate() - Argument Exception: The expression did not set a result.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's how the entire controller looks:&lt;/p&gt;
&lt;script src="https://gist.github.com/994396.js?file=DynamicModelcontroller.cs"&gt;&lt;/script&gt;

&lt;p&gt;Unfortunately, the attributes didn't have any effect. It's not like anything broke, but the form looked the exact same:&lt;/p&gt;

&lt;p&gt;&lt;a title="2011-05-21 01h51_12" href="http://www.flickr.com/photos/36836555@N00/5741965643/"&gt;&lt;img border="0" alt="2011-05-21 01h51_12" src="http://static.flickr.com/3565/5741965643_8ac86d2ff3.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I dug into the model properties using model.GetType().GetProperties() - it looks like they're present, but maybe there's something about them that ASP.NET MVC finds repugnant? Spelunking through the model properties' custom attributes shows that they are indeed present.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://farm6.static.flickr.com/5270/5763542218_13863017d3_o.png" /&gt;&lt;/p&gt;

&lt;p&gt;The end? We'll see - I'll ask / poke around and see why the attributes aren't being picked up.&lt;/p&gt;

&lt;h3&gt;References / more info on using the Mono compiler as a service:&lt;/h3&gt;

&lt;p&gt;&lt;a title="http://docs.go-mono.com/Mono.CSharp.Evaluator.Compile%20(string)" href="http://docs.go-mono.com/Mono.CSharp.Evaluator.Compile%20(string)"&gt;http://docs.go-mono.com/Mono.CSharp.Evaluator.Compile%20(string)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://docs.go-mono.com/Mono.CSharp.Evaluator.Evaluate%20(string)" href="http://docs.go-mono.com/Mono.CSharp.Evaluator.Evaluate%20(string)"&gt;http://docs.go-mono.com/Mono.CSharp.Evaluator.Evaluate%20(string)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://docs.go-mono.com/Mono.CSharp.Evaluator.Run%20(string)" href="http://docs.go-mono.com/Mono.CSharp.Evaluator.Run%20(string"&gt;http://docs.go-mono.com/Mono.CSharp.Evaluator.Run%20(string)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://www.amazedsaint.com/2010/09/how-to-host-monos-csharp-compiler-in.html" href="http://www.amazedsaint.com/2010/09/how-to-host-monos-csharp-compiler-in.html"&gt;http://www.amazedsaint.com/2010/09/how-to-host-monos-csharp-compiler-in.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://tirania.org/blog/archive/2011/Feb-24.html" href="http://tirania.org/blog/archive/2011/Feb-24.html"&gt;http://tirania.org/blog/archive/2011/Feb-24.html&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7804986" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/jgalloway/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/jgalloway/archive/tags/Mono/default.aspx">Mono</category><category domain="http://weblogs.asp.net/jgalloway/archive/tags/ASP.NET+MVC/default.aspx">ASP.NET MVC</category></item><item><title>Running the Mono VMWare image in VirtualPC</title><link>http://weblogs.asp.net/jgalloway/archive/2008/03/30/running-the-mono-vmware-image-in-virtualpc.aspx</link><pubDate>Sun, 30 Mar 2008 09:22:42 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6048126</guid><dc:creator>Jon Galloway</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/jgalloway/rsscomments.aspx?PostID=6048126</wfw:commentRss><comments>http://weblogs.asp.net/jgalloway/archive/2008/03/30/running-the-mono-vmware-image-in-virtualpc.aspx#comments</comments><description>&lt;p&gt;A lot of people love VMWare, but it bugs me. I think the main reason is that it installs with a bunch of Windows services that run automatically, every second my computer is running, whether or not I use VMWare. Since I don't use virtual machines every day, that's annoying. So, after running the free VMWare Player for a few times times, I banished it from my computer.&lt;/p&gt; &lt;p&gt;The Mono team publishes a VMWare image which makes it really easy to check out Mono on Linux without installing or building anything. If you're happy with &lt;a href="http://www.vmware.com/products/player/"&gt;VMWare, you can grab their free player&lt;/a&gt; and run the image. If, like me, you'd rather run this on Virtual PC, follow along and I'll show you how.&lt;/p&gt; &lt;p&gt;&lt;em&gt;If you don't use VirtualPC, or if you don't mind having several virtual machine hosts on your computer, this post obviously isn't for you. Thanks for stopping by, though!&lt;/em&gt;&lt;/p&gt; &lt;h3&gt;Grabbing the VMWare Image&lt;/h3&gt; &lt;p&gt;You can download the Mono VMWare image from the &lt;a href="http://www.go-mono.com/mono-downloads/download.html"&gt;Mono Downloads&lt;/a&gt; page. They offer both are http and torrent download options.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.go-mono.com/mono-downloads/download.html"&gt;&lt;img height="75" src="http://www.go-mono.com/mono-downloads/vmware_icon.jpg" width="75" border="0"&gt;&lt;img height="83" src="http://mono-project.com/skins/monoproject/images/mono-logo.png" width="69" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;h3&gt;Converting the Virtual Hard Disk image&lt;/h3&gt; &lt;p&gt;I use &lt;a href="http://vmtoolkit.com/files/folders/converters/entry8.aspx"&gt;Vmdk2Vhd from vmToolkit&lt;/a&gt; to convert the hard disk images. It's free, although there's an annoying registration step (which you can probably &lt;a href="http://www.bugmenot.com/view/vmtoolkit.com"&gt;bypass with BugMeNot&lt;/a&gt;). The interface is really simple - browse for the vmdk file, enter the destination filename, and click the "convert" button.&lt;/p&gt; &lt;p&gt;&lt;a title="Converting VMWare to VirtualPC with Vmdk2Vhd" href="http://www.flickr.com/photos/36836555@N00/2370721490/"&gt;&lt;img alt="Converting VMWare to VirtualPC with Vmdk2Vhd" src="http://static.flickr.com/3179/2370721490_c21fb9bf2b.jpg" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;h3&gt;Creating the new VirtualPC Machine&lt;/h3&gt; &lt;p&gt;Start up the VirtualPC console and go through the following steps:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Select "Create A Virtual Machine" &lt;/li&gt; &lt;li&gt;Set the Operating System to "Other"&lt;/li&gt; &lt;li&gt;You'll have to decide how much memory you can allocate to the virtual machine; on my workstation with 2GB RAM, I allocated 768MB RAM.&lt;/li&gt; &lt;li&gt;Select "Use an Existing Virtual Hard Disk" and browse to the location of the VHD file you created earlier using Vmdk2Vhd. I left "Use undo disks" unchecked.&lt;/li&gt; &lt;li&gt;Hit "Finish" and you should have a new virtual machine shown in your VirtualPC console.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&lt;a title="Mono 1.9 in VirtualPC" href="http://www.flickr.com/photos/36836555@N00/2370032635/"&gt;&lt;img alt="Mono 1.9 in VirtualPC" src="http://static.flickr.com/3130/2370032635_319aabdc5f.jpg" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;h3&gt;Setting up the Video Driver&lt;/h3&gt; &lt;p&gt;VirtualPC and Linux have a long standing feud over video drivers. &lt;a href="http://weblogs.asp.net/jgalloway/archive/2005/02/24/379505.aspx"&gt;VirtualPC emulates an S3 Trio video card with 16 bit color depth, while the Linux X Server defaults to 24 bit color depth&lt;/a&gt; since &lt;a href="http://channel9.msdn.com/ShowPost.aspx?PostID=260762#260762"&gt;that's what a real S3 Trio supports&lt;/a&gt;. The result is that Linux video under VirtualPC is always a pain in the neck. So keep with me as we jump through a few hoops to get Linux to recognize VirtualPC's video card.&lt;/p&gt; &lt;p&gt;When you start the virtual machine we created earlier, hit the down arrow to select failsafe defaults and hit enter. &lt;/p&gt; &lt;p&gt;Note: &lt;a href="http://www.suseforums.net/index.php?s=&amp;amp;showtopic=41522&amp;amp;view=findpost&amp;amp;p=218192"&gt;Previous openSUSE images required me to also fix the mouse by adding "i8042.noloop" to the failsafe boot parameters&lt;/a&gt;, but this appears to have been fixed for the 1.9 image.&lt;/p&gt; &lt;p&gt;&lt;a title="Mono VMWare Image Failsafe Startup" href="http://www.flickr.com/photos/36836555@N00/2373505274/"&gt;&lt;img alt="Mono VMWare Image Failsafe Startup" src="http://static.flickr.com/2336/2373505274_4aca12e230.jpg" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;After the boot process completes, you should be looking at a console window. You'll need to log in (root / mono) and enter "sax2 -m 0=fbdev" like so:&lt;/p&gt; &lt;p&gt;&lt;a title="VirtualPC Linux Video - SAX2" href="http://www.flickr.com/photos/36836555@N00/2373505048/"&gt;&lt;img alt="VirtualPC Linux Video - SAX2" src="http://static.flickr.com/3227/2373505048_8b178462ca.jpg" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;SaX2 churns for a bit, then comes up in graphics mode. You can change the configuration, but I just clicked on OK.&lt;/p&gt; &lt;p&gt;&lt;a title="Linux-SAX2" href="http://www.flickr.com/photos/36836555@N00/2372709863/"&gt;&lt;img alt="Linux-SAX2" src="http://static.flickr.com/2293/2372709863_e2a7a719d1.jpg" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;At this point, you'll need to reboot. You can do that in the VirtualPC menu (Action / Reset), or you can just type "shutdown -r 0" at the command prompt. When it comes back up, you can boot to Mono 1.9 / openSUSE 1.3 without using the Failsafe options.&lt;/p&gt; &lt;p&gt;&lt;a title="Mono 1.9 in VirtualPC" href="http://www.flickr.com/photos/36836555@N00/2372723829/"&gt;&lt;img alt="Mono 1.9 in VirtualPC" src="http://static.flickr.com/2074/2372723829_d0f019e5c6.jpg" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;We've got one more thing to set up - the network connection is disabled by default. You can connect by clicking on the network icon in the lower right-hand corner, then on "Wired".&lt;/p&gt; &lt;p&gt;&lt;a title="openSUSE Network Connection" href="http://www.flickr.com/photos/36836555@N00/2373590934/"&gt;&lt;img alt="openSUSE Network Connection" src="http://static.flickr.com/3190/2373590934_293a220534.jpg" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Stay tuned - in the next post, we'll make use of this image to take a look at Moonlight, the open source implementation of Silverlight on Linux.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6048126" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/jgalloway/archive/tags/Virtual+PC/default.aspx">Virtual PC</category><category domain="http://weblogs.asp.net/jgalloway/archive/tags/Mono/default.aspx">Mono</category></item></channel></rss>