CS-Script 3.27.0


CS-Script version compatibility

One of the CS-Script runtime settings is Target CLR version. This setting controls the version of CLR used to run script on a particular PC. Basically it means that if different versions of CLR are installed on the PC you can specify which one should be used. 

CS-Script version compatibilty concept is in fact the very same concept which all CLR applications follow. 

CLR usually can execute any assembly built for previous CLR version (however run time behaviour isn't garanteed).

CLR cannot execute assembly built for CLR versions higher than the current one 

This implays some practical limitations. For example if you want to execute a script on PC with CLR v1.1 and v2.0 installed and CS-Script is configured to use v1.1 as a target CLR version, you will not be able to load any assembly, which was build using .NET 2.0.  

Note: The CS-Script itself does not implement the compatibility concept as such. It is CLR who restricts or allows execution on the base of the particular assembly (including the script engine executable).

The following table describes all possible "start script" and "load assembly" scenarios for PC, which has CLR v1.1 and v2.0  installed.  

Target CLR
version
CS-Script engine
(built using .NET version)
External assembly
(built using .NET version)
Possibility
to run
CS-Script engine?
Possiblilty
to reference
external assembly
from
script?
1.1 1.1 1.1 Yes Yes
1.1 1.1 2.0 Yes No
2.0 1.1 1.1 Yes Yes
2.0 1.1 2.0 Yes Yes
1.1 2.0 1.1 No N/A
1.1 2.0 2.0 No N/A
2.0 2.0 1.1 Yes Yes
2.0 2.0 2.0 Yes Yes


You can see now why the currently released version of CS-Script is buit using .NET 1.1. It is because this build can run on both .NET 1.1 and .NET 2.0.  It is possible because the script engine is implemented without using any version specific CLR features. This approach will be used in the future as long as the latest released version of .NET does not break it's backward compatibility.


Note: selecting specific version of CLR a s Target CLR version does not make your script to be executed under the selected CLR but only compiled. If you want your script to be fully hosted under a specific CLR you need to use the hosating control directive (//css_host) in your script.

See Also 

CS-Script settings