[英]Error when running Windows Mobile application
I am writing a hello world program for Windows Mobile, just for the fun of it.我正在为 Windows Mobile 编写一个 hello world 程序,只是为了好玩。 (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.我在 SDK 命令提示符中使用了 C# 编译器。 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:
当我运行 exe 时,它在 Windows 10 中运行良好。但是,当我在 Windows Mobile 模拟器中运行它时,出现此错误:
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?我是否需要更新版本的 .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.我找到了一种无需 VS 2008 即可使其工作的方法。我使用了 SDK 命令提示符。 I found the command here: https://www.codeproject.com/Articles/31861/Windows-Mobile-Development-Without-Visual-Studio .
我在这里找到了命令: https : //www.codeproject.com/Articles/31861/Windows-Mobile-Development-Without-Visual-Studio 。 My app runs fine in the emulator.
我的应用程序在模拟器中运行良好。 Thanks for the help!
谢谢您的帮助!
What you need is VS 2008 (no typo) and the Windows Mobile 6.x SDKs installed on your maschine.您需要的是 VS 2008(没有拼写错误)和安装在您机器上的 Windows Mobile 6.x SDK。 Newer versions of Visual Studio do not support compact framework
较新版本的 Visual Studio 不支持紧凑框架
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.