When using DotNet data type in NAV C/AL we normally lookup a sub type to use. When we do the result can be something like
Newtonsoft.Json.Linq.JObject.'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
Then, what will happen when moving this code from NAV 2016 to NAV 2017 and NAV 2018. The Newtonsoft.Json version is not the same and we will get a compile error!
Just remove the version information from the sub type information.
Newtonsoft.Json.Linq.JObject.'Newtonsoft.Json'
And NAV will find the matching Newtonsoft.Json library you have installed and use it.
This should work for all our DotNet variables.
Why so late, WHY? lol
Thanks Gunnar 😉
Yes, I know. Sorry!
Hi Gunnar,
it seems that this only works for libraries from the Add-In-directory. When I try to do this with something from the .NET Framework it won’t work; e.g.:
System.Net.FtpWebRequest.’System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′
System.Net.FtpWebRequest.’System’
The second variant will throw an error Could not load type ‘System.Net.FtpWebRequest.’System”. When I try the same with something from the Add-In-library it works fine.
Just wanted to leave it here, in case someone else stumbles upon this ?
I have seen this too. But mscorlib library works even if it is not in the add-ins folder. Don’t know the logic.
Thanks Simon.
Note that you will run into issues regarding old library versions that stick in your %temp% folder. Make sure to clean that.