简体   繁体   English

通知用户.exe适用于比当前安装的.NET更高的版本

[英]Notify user that .exe is targeted for newer version of .NET than is currently installed

With a simple, single .exe application, is it possible to target a .NET framework version that is newer than the version installed on the end-user's computer, and somehow notify the end-user when launching the application that he/she needs to install a newer version of .NET in order to use the app? 使用简单的单个.exe应用程序,可以定位比最终用户计算机上安装的版本更高的.NET Framework版本,并在启动该应用程序时以某种方式通知最终用户他/她需要安装新版本的.NET以便使用该应用程序?

Under normal circumstances when launching a .NET .exe that was compiled for a newer version of .NET than the version that is currently installed, it seems that sometimes there is a comprehensible message popped up stating that to run the application you must first install version X of the .NET Framework. 通常情况下,当启动的.NET .exe是为比当前安装的.NET更高的版本编译的.NET时,似乎有时会弹出一条可理解的消息,指出要运行该应用程序,您必须先安装该版本.NET Framework的X。 This is good. 很好 However, it doesn't necessarily notify to install the correct/needed version (see screenshot below where it says to install 4.0.30319 even though 4.6 is needed), and other times it seems that the popped message is just a generic CLR error with no explanation that it's due to the wrong version of .NET being installed. 但是,它不一定会通知您安装正确/所需的版本(请参见下面的屏幕快照,即使需要4.6也要安装4.0.30319),而在其他情况下,弹出的消息似乎只是一个通用的CLR错误,带有没有说明这是由于安装了错误的.NET版本造成的。

Are there any clever ways to produce/display a consistent/reliable more meaningful or customized message to the end user so that there is never a possibility of him/her just receiving a generic CLR error or a message stating that a version of .NET is needed but it states the wrong version to install? 是否有任何聪明的方法可以向最终用户生成/显示一致/可靠的,更有意义的或自定义的消息,从而使他/她永远不可能仅收到一般的CLR错误或表明.NET版本是需要,但显示安装错误的版本?

Windows 2008R2 with .NET 3.5.1 installed when app is targeting .NET 4.6: 当应用程序针对.NET 4.6时安装了.NET 3.5.1的Windows 2008R2:

在此处输入图片说明

Windows 2012R2 with .NET 4.5 installed when app is targeting .NET 4.6: 将应用定位到.NET 4.6时安装了.NET 4.5的Windows 2012R2:

在此处输入图片说明

You could code a pre-launch program that checks the windows system to see what is installed. 您可以编写一个预启动程序,以检查Windows系统以查看安装了什么。 Then you can pop up whatever warning you want, or if all is OK then just launch your main program. 然后,您可以弹出任何想要的警告,或者如果一切正常,则只需启动主程序。

Also, as Lex Li posted, you can create an installer bundle. 另外,如Lex Li所介绍的,您可以创建安装程序包。 We use Inno Setup at the place I work, it's free and very comprehensive. 我们在我工作的地方使用Inno Setup,它是免费的并且非常全面。

暂无
暂无

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

相关问题 在点网中的旧版本上运行较新的exe - Running newer exe on older version in dot net 获取错误“'targetFramework'属性当前引用的版本晚于安装的.NET Framework版本” - Getting Error “The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework” 什么版本的 .Net 框架应该针对最终用户应用程序 - What version of .Net framework should be targeted for end user apps 如何以编程方式验证 .Net 运行时是否比特定版本更新 - How to programmatically verify that .Net runtime is newer than a specific version 无法正确引用当前安装的.NET Core版本 - Failing to correctly reference currently installed version of .NET Core 无法安装 .NET 框架,因为 Windows 认为安装了较新的版本 - Can't install .NET framework because Windows thinks newer version is installed “此程序集由比当前加载的运行时更新的运行时构建,无法加载” - “This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded” 该程序集由比当前加载的运行时新的运行时构建,无法加载 - This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded 使用较早版本的目标.NET Framework DLL和较新版本的.NET Framework的C#缺点 - C# Disadvantage of using earlier targeted .NET Framework DLL with newer versions of .NET Framework 需要从.Net 2升级到更新版本吗? - Need to upgrade from .Net 2 to a newer version?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM