如何使 .Net 4.0 Exe 要求用户在运行此 exe 之前下载 .Net 4.0 框架/可再发行组件?

发布于 2024-09-04 07:20:00 字数 691 浏览 3 评论 0原文

我认为最新的 Matlab 会自动执行此操作。我在干净的 Win XP 虚拟机上测试了以下 exe:

namespace DotNetTest
{
    using System.Windows.Forms;

    class Program
    {
        static void Main(string[] args)
        {
            MessageBox.Show("Howdy!");
        }
    }
}

当我在安装了所有这些的计算机上运行它时,它确实显示消息框和窗口。当我在干净的虚拟机上运行它时,我收到此错误:

Title: DotNetTest.exe - Application Error
Icon: Error
Buttons: {OK}
Message Body: The application failed to initialize properly (0xc0000135). Click on OK to terminate the application.

我对 MSFT 天才的期望会更好。为什么每个 .Net exe 不能包含一点点开销,并让它的第一个字节来检测 .Net 是否安装并呈现更好的消息。

我可以翻转某种设置来解决这个问题吗?所有设置都是我创建新项目时VS2010提供的默认设置。

谢谢。

I thought that latest Matlab does this automatically. I have tested the following exe on a clean Win XP VM:

namespace DotNetTest
{
    using System.Windows.Forms;

    class Program
    {
        static void Main(string[] args)
        {
            MessageBox.Show("Howdy!");
        }
    }
}

When I run it on a computer which has all these installed, it does show the message box and a window. When I run it on a clean VM, I get this error:

Title: DotNetTest.exe - Application Error
Icon: Error
Buttons: {OK}
Message Body: The application failed to initialize properly (0xc0000135). Click on OK to terminate the application.

I would expect better from MSFT geniuses. Why cannot every .Net exe contain a tiny bit of overhead and have the very first bytes of it do the work of detecting if .Net is installed and presenting a better message.

Is there some sort of setting that I can flip to fix this? All of the settings were default ones provided by VS2010 when I created a new project.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小…红帽 2024-09-11 07:20:00

这就是您使用安装程序的目的。在 .net 中,这很简单,您只需“发布”您的项目,然后您将获得一个安装程序,使 .net 已安装等。应用程序本身永远不必担心这一点。

This is what you use an installer for. In .net this is simple, you just "publish" your project and you get an installer that makes shure that .net is installed and such. The application itself should never have to worry about that.

酷遇一生 2024-09-11 07:20:00

正如亚历山大所说,您确实应该使用安装程序来实现此目的。如果这是不可能的,您必须先编写一个非托管 exe 来运行,然后启动 .net exe 或告诉用户下载框架,具体取决于框架是否已安装。

As Alexandr says, you should really use the installer for this. If that's not possible, you'd have to write an unmanaged exe to run first and then either start the .net exe or tell the user to download the framework depending on if it's already installed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文