How to target CF.NET 3.5?

moster67

Expert
Licensed User
Longtime User
Hi,

I am writing an application which uses HTTPS (and SSL) and got stuck due to this bug in CF.NET:

Andrew Arnott : Why .NET Compact Framework fails to call some HTTPS web servers

A hotfix was finally released (see this post: My MS Blog : .NET CF Hotfix - CF failed to call some HTTPS web servers when encrytpion is enabled) which I installed but still, my application wouldn't work on my device (works Ok on Desktop). I noted that my device also had CF.NET 2.0 installed and there was no way I could uninstall it (unless I modified the registry which I don't want my users to do). By using a tool included in CF.NET 3.5 Power Toys, I could force an application on my device to use CF.NET 3.5 which I did with my application. In this way, my application now works as it should.

In VB.Net or C#, I guess could have avoided the last step by targeting my application to use CF.NET 3.5. So, I am wondering if there is a way in Basic4PPC which permits me to target CF.NET 3.5 (including libraries) even if CF.NET 2.0 is installed on the device?

Thanks
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can create a config file like the one used before Basic4ppc v6. This file forces your application to run with a specific version of the .Net Framework.
You should create a file named YourApp.exe.config with the following content:
B4X:
<configuration> 
  <startup> 
    <supportedRuntime version="v3.5.7283"/> 
    <supportedRuntime version="v2.0.7045"/> 
    <supportedRuntime version="v2.0.6129"/> 
    <supportedRuntime version="v2.0.5238"/> 
  </startup> 
</configuration>
Remove or add versions that you want to support. I'm not sure if the first one is the latest version of .Net CF 3.5.
This file should be distributed together with your application.
 

moster67

Expert
Licensed User
Longtime User
thanks. I will try to experiment with the config-file.

BTW: If CF.NET 3.5 is not installed on the device and using the config-file in your example, it will fall back to CF.NET 2.0. Is this correct?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…