启用App以.NET 3.5和.NET 4为目标? [英] Enable App to target .NET 3.5 and .NET 4?

查看:146
本文介绍了启用App以.NET 3.5和.NET 4为目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


 


< p style ="margin:0px"> 我有一个Visual Basic应用程序,我正在使用VS 2017。该应用程序最初是为了面向.NET Framework 3.5而创建的。我想允许该应用程序以.NET 3.5
或/和4.0 / 4.5为目标,因此它可以在装有.NET Framework 3.5的计算机上运行,​​也可以在只有.NET Framework 4.0或4.5的计算机上运行。


 


我正在审阅这篇文章:

https://docs.microsoft.com/en-us/dotnet / framework / migration-guide / how-to-configure-an-app-to-support-net-framework-4-or-4-5
看起来应该可以通过编辑app.config文件。我编辑了app.config
文件并添加了以下行,以允许基于文章进行多框架定位。


 


<跨度风格= "保证金:0像素;颜色:#1f497d"> <跨度风格= "字体大小:介质">&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP; <启动>&NBSP;


&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP; < supportedRuntime
version =" v4.0" />


<跨度风格=" 字体大小:介质">&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < supportedRuntime
version =" v2.0.50727" />


<跨度风格=" 字体大小:介质">&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < / startup>


 


应用程序在安装了.NET Framework 3.5的计算机上运行,​​但它不能在安装了.NET Framework 4.5的Windows 10计算机上运行(Exact $安装b $ b版本是:4.7.02046)。我得到你需要.NET 3.5并提示下载的提示:





任何想法是什么我可能在这里失踪?




Justin Chalfant | 我的博客 |
LinkedIn
|如果这解决了你的帖子,请标记为有用/回答

解决方案

贾斯汀,


为什么不将框架设置为3.5并让它继续下去呢?


3.5毕竟会在任何3.5及以上版本上运行,所以...?


Hi All,

 

I have a Visual Basic application and i'm using VS 2017. The app was originally created to target .NET Framework 3.5. I would like to allow the app to target .NET 3.5 or/and  4.0/4.5 so it could run on a machine with .NET Framework 3.5 or a machine with just .NET Framework 4.0 or 4.5.

 

I was reviewing this article: https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-configure-an-app-to-support-net-framework-4-or-4-5 it seems like this should be possible by editing the app.config file. I edited the app.config file and added the following lines to allow multi framework targeting based on the article.

 

              <startup> 

                           <supportedRuntime version="v4.0"/>

                           <supportedRuntime version="v2.0.50727"/>

              </startup>

 

What happens is the app works on a machine with .NET framework 3.5 installed, but it won’t run on a Windows 10 machine with just .NET Framework 4.5 installed (Exact version installed is: 4.7.02046). I get the prompt you need .NET 3.5 and prompted to download:


Any idea what I may be missing here?


Justin Chalfant | My Blog | LinkedIn | Please mark as helpful/answer if this resolved your post

解决方案

Justin,

Why not set the framework to 3.5 and let it go at that?

3.5 will run on anything 3.5 and above after all, so ...?


这篇关于启用App以.NET 3.5和.NET 4为目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆