Forum Discussion

DHB's avatar
DHB
Occasional Contributor
13 years ago

CLR Bridge - Switch between different versions of .NET framework

Hello,



I have got multiple versions of the .NET Framework installed on my PC.

How can I configure the CLR bridge to use a specific version of these frameworks?



My issue:

Following command produces different output, depending on the highest version of .NET Framwork installed:



dotNET.System_Globalization.CultureInfo.GetCultureInfo_2('zh-CN').DisplayName



  • .NET Version 3.5 SP1 (with german language pack) = "Chinesisch (VR China)".


  • .NET Framework 4.0 (with german language pack) = "Chinesisch (Vereinfacht, VR China)"




The application under test, for which I am using this code, is compiled for .NET Version 3.5. For another application on the same PC I need version 4.0, so deinstallation is no option.



I would like to tell TestCompletes CRL bridge to call the routine from .NET Version 3.5 to get the same value, which the application under test produces.



Any suggestions?



(WinXP SP3 Multilanguage, Culture Settings: German)
  • Hello everyone,



    I think I can share another possible solution I suggested to Dirk within a support case on the matter:

    1. Create an intermediate .NET application and explicitly load the needed assemblies to it.



    2. Build the project using the needed version of .NET.



    3. In order to call the needed routines from TestComplete, run the intermediate application and call them through the AppDomain.dotNET property (to learn more, see the "dotNET Property" help topic):

    Sys.Process("fakeApp").AppDomain("fakeApp.exe").dotNET
  • AlexeyKryuchkov's avatar
    AlexeyKryuchkov
    SmartBear Alumni (Retired)
    Hello everyone,



    I think I can share another possible solution I suggested to Dirk within a support case on the matter:

    1. Create an intermediate .NET application and explicitly load the needed assemblies to it.



    2. Build the project using the needed version of .NET.



    3. In order to call the needed routines from TestComplete, run the intermediate application and call them through the AppDomain.dotNET property (to learn more, see the "dotNET Property" help topic):

    Sys.Process("fakeApp").AppDomain("fakeApp.exe").dotNET
  • AlexeyKryuchkov's avatar
    AlexeyKryuchkov
    SmartBear Alumni (Retired)
    Hi Dirk,



    You can specify which version of the .NET Framework should be used for a specific application in the application's config file. This file has the same name as the application executable file with the extension and the 'config' extension, and it should be placed in the same folder.



    For example, if you want TestComplete to work only with .NET Framework version 3.5, you need to create the following file in the '<TestComplete>\Bin' folder:



    [testcomplete.exe.config]

    <?xml version ="1.0"?>

    <configuration>

       <startup>

           <supportedRuntime version="v3.5" safemode="true"/>

           <requiredRuntime version="v3.5" safemode="true"/>

       </startup>

    </configuration>
  • AlexeyKryuchkov's avatar
    AlexeyKryuchkov
    SmartBear Alumni (Retired)
    Hi Dirk,



    You're right - actually, the "tcHostingProcess.exe.config" approach should work. Since it didn't, possibly, you have an x64 OS and the needed config file should reside in the "C:\Program Files (x86)\SmartBear\TestComplete 9\x64\Bin" folder. Did you try modifying the "C:\Program Files (x86)\SmartBear\TestComplete 9\x64\Bin\tcHostingProcess.exe.config" file?
  • DHB's avatar
    DHB
    Occasional Contributor
    Hello Mike,



    thank you for your hint. But your solution does not seem to work.

    It seemed to me that "TestComplete.exe" was the wrong file to configure, so I also tried to build up a file with the content called "tcHostingProcess.exe.config". But I could not reach my goal either.



    I used the following links to get more info on the parameters you mentioned:

    http://msdn.microsoft.com/en-us/library/w4atty68%28v=vs.90%29.aspx

    http://msdn.microsoft.com/en-us/library/a5dzwzc9%28v=vs.90%29.aspx



    Are there any other suggestions I can try?
  • DHB's avatar
    DHB
    Occasional Contributor
    Hi Mike,



    I used WinXP 32bit. I have also tried it on Win7 32bit, but it doesn't work either.
  • DHB's avatar
    DHB
    Occasional Contributor
    Hello Mike,



    the mentioned solution works. In my case I did not create a new app, I use the running AUT.



    Thank you ;o)