[英]How to force a specific .Net version (down to the minor/minor-minor version number) to be used when running an app
I have installed different versions of the.Net framework on my machine and I wonder if it is possible to choose one specifically when running a.Net app.我在我的机器上安装了不同版本的 .Net 框架,我想知道是否可以在运行 .Net 应用程序时专门选择一个。
I tried setting it in App.config like so:我尝试像这样在 App.config 中设置它:
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
but when I check the version being actually used via RuntimeInformation.FrameworkDescription
, the output is .NET Framework 4.8.4261.0
, even though v4.6.1 is installed on my system.但是当我通过RuntimeInformation.FrameworkDescription
检查实际使用的版本时,输出是.NET Framework 4.8.4261.0
,即使我的系统上安装了 v4.6.1。
How can one test a specific version, eg to see whether a bug shows on a particular.Net version?如何测试特定版本,例如查看特定 .Net 版本上是否显示错误?
You could specify the .NET Version for your application by changing it in your application propreties, in Visual Studio right-click on your project and then propreties, under Application tab.您可以通过在应用程序属性中更改它来为您的应用程序指定 .NET 版本,在 Visual Studio 中右键单击您的项目,然后在应用程序选项卡下右键单击属性。
Then Visual Studio will update config files automatically.然后 Visual Studio 将自动更新配置文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.