Bare Bones Avalon Hello World App

Here's the most basic Avalon app I could make:

using System;
using MSAvalon.Windows;
public class MyApp : Application
{
    private Window win;
    protected override void OnStartingUp(StartingUpCancelEventArgs e)
    {
        win =
new Window();
        win.Text = "Hello World!";
        win.Show();
    }

    [STAThread]
    public static void Main()
    {
        MyApp app =
new MyApp();
        app.Run();
    }
}

use this command line to build:

csc /t:winexe /r:WindowsBase.dll,PresentationCore.dll,PresentationFramework.dll Hello.cs

Alternatively you can slap the following into a .proj file and use MSBuild to compile the app:

<Project DefaultTargets="Build">
    <PropertyGroup>
        <Property Language="C#" />
        <Property TargetName="Hello" />
    </PropertyGroup>

    <Import Project="$(LAPI)\WindowsApplication.target" />

    <ItemGroup>
        <Item Type="Compile" Include="*.cs" />
    </ItemGroup>
</Project>

No Comments