The requiredRuntime element of the .config file in the version attribute determines which version of the .NET runtime the application should use.
Where on a given computer to see the possible values ​​for the version attribute?

  • Do you mean a list of installed versions of .NET? - VladD
  • I mean "possible values ​​for the version attribute". - mals
  • But you write "on a given computer." Possible attribute values ​​do not depend on the computer on which you view them. - VladD
  • The documentation says it should be the root installation . - VladD
  • But in Russian documentation . But there is documentation, but there is practice. - mals

2 answers 2

Valid values ​​are folder names from C:\Windows\Microsoft.NET\Framework\v4.0.30319 or C:\Windows\Microsoft.NET\Framework64 .

You can enter any value (at least any in the format vX.YZQ), for example, v10.0.0.0 or v3.0.0.0 .

At startup, the existence of the C:\Windows\Microsoft.NET\Framework\vX.YZQ and the clr.dll file or mscorwks.dll file is clr.dll . If there is no file, then a window is displayed offering to install the corresponding version. If there is a file, then it is used to start the application.

Those. if you make a copy of the v4.0.30319 folder with the name v10.0.0.0 and specify the requiredRuntime version="v10.0.0.0" - then the application starts quite correctly.

  • And you can add links to sources? I read about mscorwks.dll in the XML.NET book, but it’s about .NET 2.0, and beta. Therefore, I wanted to find more relevant links. - mals
  • I used Process Monitor as sources. there you can see how the application goes through folders. then I threw what it was looking for there (one file, then the whole folder) and looked at the result. - PashaPash
  • Mechanism since the times of .net 2.0 has not changed much - the requiredRuntime was introduced at the time of 1.0 / 1.1 - PashaPash

This is a compiler option, so in its config you need to look

Here are a couple of examples:

\ Windows \ Microsoft.NET \ Framework64 \ v2.0.50727 \ csc.exe.config

 <?xml version ="1.0"?> <configuration> <startup> <supportedRuntime version="v2.0.50727" safemode="true"/> <requiredRuntime version="v2.0.50727" safemode="true"/> </startup> </configuration> 

\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ csc.exe.config

 <?xml version ="1.0"?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0.30319"/> </startup> </configuration> 

Ps: compiler vb config is called vbc.exe.config

  • Addition: you can not rely on folder names, for example, in the config \ Windows \ Microsoft.NET \ Framework64 \ v3.5 \ csc.exe.config the version v2.0.50727 is indicated - SanŚ́́́́́́́́́́́́́
  • This is not a compiler option. This is a specific application option. - PashaPash