简体   繁体   English

运行 Windows Mobile 应用程序时出错

[英]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.

相关问题 将应用程序作为Windows服务运行时的汇编文件加载错误 - assembly file load error when running application as windows service 在C#Windows应用程序中运行Matlab脚本时出错 - Error when running Matlab script in C# Windows Application 运行Windows Phone 8应用程序时出现System.IO.FileNotFoundException错误 - System.IO.FileNotFoundException error when running Windows Phone 8 application 运行Windows应用程序时及时调试器错误 - just in time debugger error when running windows application 运行.NET CF 3.5应用程序时Windows Mobile 6.5文件系统使Motorola MC55崩溃 - Windows Mobile 6.5 file system crash Motorola MC55 when running .NET CF 3.5 application 确保Windows Mobile应用程序未运行-从桌面应用程序 - Ensuring Windows Mobile application is not running - From a desktop app 运行 Windows 10 的应用程序中的 EAccessViolation 错误 - EAccessViolation Error in application running Windows 10 运行c#windows应用程序时出错 - Error in running c# windows application 运行 windows 卸载程序时关闭应用程序 - Close application when running windows uninstaller 在WPF应用程序运行时保持Windows清醒 - Keep Windows awake when a WPF application is running
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM