简体   繁体   English

如何在运行应用程序时强制使用特定的 .Net 版本(低至次要/次要版本号)

[英]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.

相关问题 NuSpec-如何将$ version $缩减为Major.Minor.Build(SemVersion)? - NuSpec - how to trim $version$ down to Major.Minor.Build (SemVersion)? 发布具有特定次要版本的 do.net 核心 - Publish dotnet core with specific minor version 在我的版本更新程序中更改 Minor 值 - Changing Minor value in my version updater 如何将解决方案的所有包更新到最新的次要版本 Nuget? - How to Update All Packages of solution to Latest Minor Version Nuget? 如何与其 DLL 共享主应用程序的主要和次要版本? - How to share major and minor version of the main application with its DLLs? 发布项目时如何在Visual Studio 2022中使用global.json设置SDK小版本? - How to use global.json in Visual Studio 2022 to set SDK minor version when publishing project? gacutil和环境中的次要版本差异导致严重的麻烦 - Minor version difference in gacutil and environment causing major headaches 我们可以使用汇编版本的次要值添加额外的字符吗? - Can we add an extra character with the minor value of the assembly version? 次要版本在C#中仅返回一位数字 - Minor version returns only single digit in c# 是否可以将.NET中的内部版本号和修订号切换为[主要]。[次要]。[补丁]。[内部] - Is it possible to switch build and revision number in .NET to [Major].[Minor].[Patch].[Build]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM