I am writing a hello world program for Windows Mobile, just for the fun of it. (I am aware that it is a dead platform)
Here is my code:
using System;
using System.Drawing;
using System.Windows.Forms;
namespace HelloWorld
{
class HelloWorldForm : System.Windows.Forms.Form
{
Label lblHello;
Button btnClose;
public HelloWorldForm()
{
this.Text = "Hello, world!";
btnClose = new Button();
lblHello = new Label();
btnClose.Click += new EventHandler(btnClose_Click);
btnClose.Text = "Close";
btnClose.Location = new Point (10, 100);
btnClose.Size = new Size(200, 50);
lblHello.Text = "Hello, world! - From the Tectra team";
lblHello.Location = new Point(10, 10);
lblHello.Size = new Size(200, 50);
SuspendLayout();
this.Controls.Add(lblHello);
this.Controls.Add(btnClose);
ResumeLayout(false);
}
void btnClose_Click(object sender, EventArgs args)
{
this.Close();
}
static void Main()
{
HelloWorldForm helloworld = new HelloWorldForm();
Application.Run( helloworld );
}
}
}
I used the C# Compiler in SDK Command Prompt. When I run the exe it works fine in Windows 10. When I run it in the Windows Mobile emulator, however, I get this error:
File or assembly name 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089', or one of its dependencies, was not found.
Do I need a newer version of the .NET Compact Framework? Any help is welcome as I am quite perturbed about this problem. Thank you!
I found a way to make it work without VS 2008. I used the SDK Command Prompt. I found the command here: https://www.codeproject.com/Articles/31861/Windows-Mobile-Development-Without-Visual-Studio. My app runs fine in the emulator. Thanks for the help!