dotnet.al compile error system.xml

TallyHoTallyHo Posts: 56Member
edited 2018-12-06 in NAV Three Tier
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?


Do not go where the path may lead,
go instead where there is no path and leave a trail.

Best Answer

  • TallyHoTallyHo Posts: 56
    edited 2018-12-07 Accepted Answer
    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 :/

    Do not go where the path may lead,
    go instead where there is no path and leave a trail.

Answers

  • SanderDkSanderDk Posts: 116Member
    Hi TallyHo,
    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?
  • TallyHoTallyHo Posts: 56Member
    Hi SanderDk,

    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"

    Do not go where the path may lead,
    go instead where there is no path and leave a trail.
  • SanderDkSanderDk Posts: 116Member
    Try:
    bvbcbxdhfnux.png
  • TallyHoTallyHo Posts: 56Member
    I Tried this, it makes a difference. But not for the better:

    [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.

    Do not go where the path may lead,
    go instead where there is no path and leave a trail.
  • TallyHoTallyHo Posts: 56Member

    tpap1hdxhnrf.jpg

    Do not go where the path may lead,
    go instead where there is no path and leave a trail.
  • TallyHoTallyHo Posts: 56Member
    5v2z1bvml2gs.jpg

    Do not go where the path may lead,
    go instead where there is no path and leave a trail.
  • TallyHoTallyHo Posts: 56Member
    At last..

    5f7ymk2xiefs.png

    Do not go where the path may lead,
    go instead where there is no path and leave a trail.
  • TallyHoTallyHo Posts: 56Member
    edited 2018-12-07 Accepted Answer
    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 :/

    Do not go where the path may lead,
    go instead where there is no path and leave a trail.
  • SanderDkSanderDk Posts: 116Member
    > @TallyHo said:
    > 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 :)
Sign In or Register to comment.