简体   繁体   English

在未安装.NET4.0的计算机中执行.NET4.0应用程序时会发生什么?

[英]What happens when executing a .NET4.0 app in a computer without .NET4.0 installed?

Very simple question, if you compile a program with .NET 4.0 (a program that explicitly uses a feature from .NET 4.0 which is not available in previous framework versions), say a command line program, and you deploy it to a computer that doesn't have .NET 4.0 (let's say it only has .NET2.0 framework). 一个非常简单的问题,如果您使用.NET 4.0编译程序(该程序明确使用.NET 4.0中的功能,而该功能在以前的框架版本中不可用),则说一个命令行程序,然后将其部署到没有此功能的计算机上。没有.NET 4.0(假设它只有.NET2.0框架)。

What happens when you run the .exe from the command line? 从命令行运行.exe会发生什么? Is there an exception thrown? 是否抛出异常? Which exception? 哪个例外?

I could test myself but I don't have right now a Windows box handy that lacks this framework version. 我可以测试一下自己,但是现在没有一个缺少此框架版本的Windows box。

Thanks in advance. 提前致谢。

You will get the following error: 您将收到以下错误:

要运行该应用程序,首先必须安装以下版本的.NET Framework之一:v4.0.30319。请与您的应用程序发行商联系,以获取有关获取适当版本的.NET Framework的说明。

You won't be able to start the executable as a whole. 您将无法整体启动可执行文件。 You will either get an Exception (in the form of Windows encountered an error.. etc) Or you will get a notice that you don't have the right .NET version (not to sure about this last part though..) 您将得到一个Exception(以Windows的形式遇到错误。等等),或者您将收到一个通知,指出您没有正确的.NET版本(尽管不确定最后一部分。)

You might get an System.IO.FileLoadException with a message:"Could not load file or assembly ... Version 4.0.0 ..." when you try to run a .NET 4 program on a machine with a previous version of .NET installed. 当您尝试在早期版本的.NET 4程序上运行.NET 4程序时,可能会收到一条System.IO.FileLoadException消息:“无法加载文件或程序集...版本4.0.0 ...”。 NET安装。

Hope this helps... 希望这可以帮助...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM