Hi,
This is probably a no-brainer for any .net developer,
But I'm stuck again upgrading another C/AL solution to AL.
This is the content of my dotnet.al file, I obtained it by using txt2al.exe.
dotnet
{
assembly("System.xml")
{
Version='2.0.0.0';
Culture='neutral';
PublicKeyToken='b77a5c561934e089';
type("System.Xml.XmlDocument";SystemXmlDocument){}
type("System.Xml.XmlNodeList";SystemXmlNodeList){}
type("System.Xml.XmlNodeType";SystemXmlNodeType){}
type("System.Xml.XmlNamedNodeMap";SystemXmlNamedNodeMap){}
}
}
I added "target": "Internal" to app.json. This fixed most of the problems.
But the line assembly("System.xml") is still not compiling in Visual Studio.
Now this is probably just fixed by changing the, name or Version from 2.0.0.0 to something else.
But how do I know what name, version or PublicKeyToken to use?
0
Answers
When you design the object i C/Side, can you go look at the dotnet assembly, there you can see if there is a newere version of the same assembly. Properly there is a 4.0.0.0. But what error are you getting in VS Code?
System.Xml.XmlDocument.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Is what is in C/Side. So I changed the version in VS to 4.0.0.0.
That is not working.
This is the error I get in VS
[AL] An assembly named 'System.xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' could not be found in the assembly probing paths 'c:\Users\[User]\Documents\AL\[project folder]\./.netpackages' [AL0451]
.NET Assembly "System.xml"
[AL] An assembly named 'System.Xml, Version=4.0.0.0, PublicKeyToken=null' could not be found in the assembly probing paths 'c:\Users\[User]\Documents\AL\[project folder]\./.netpackages' [AL0451]
.NET Assembly "System.Xml"
It seems like the PublicKeyToken cannot be read at all now.
the mscorlib assembly doesn't have this problem.
{
"al.assemblyProbingPaths": [
"./.netpackages",
"c:/Windows/assembly/",
"C:/Program Files/Microsoft Dynamics 365 Business Central/130/Service/Add-ins"
]
}
https://www.hougaard.com/dotnet-with-extensions-v2/
mscorlib always works, all the others have to be defined by user setting
> Solved by changing VS user settings, now I can compile:
>
> {
> "al.assemblyProbingPaths": [
> "./.netpackages",
> "c:/Windows/assembly/",
> "C:/Program Files/Microsoft Dynamics 365 Business Central/130/Service/Add-ins"
> ]
> }
>
> https://www.hougaard.com/dotnet-with-extensions-v2/
>
> mscorlib always works, all the others have to be defined by user setting
Nice catch