dotnet.al compile error system.xml

TallyHoTallyHo Posts: 37Member
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?

I'm not confused. I'm just well mixed.

Best Answer

  • TallyHoTallyHo Posts: 37
    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 :/
    I'm not confused. I'm just well mixed.

Answers

  • SanderDkSanderDk Posts: 64Member
    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: 37Member
    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"
    I'm not confused. I'm just well mixed.
  • SanderDkSanderDk Posts: 64Member
    Try:
    bvbcbxdhfnux.png
  • TallyHoTallyHo Posts: 37Member
    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.
    I'm not confused. I'm just well mixed.
  • TallyHoTallyHo Posts: 37Member

    tpap1hdxhnrf.jpg
    I'm not confused. I'm just well mixed.
  • TallyHoTallyHo Posts: 37Member
    5v2z1bvml2gs.jpg
    I'm not confused. I'm just well mixed.
  • TallyHoTallyHo Posts: 37Member
    At last..

    5f7ymk2xiefs.png
    I'm not confused. I'm just well mixed.
  • TallyHoTallyHo Posts: 37Member
    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 :/
    I'm not confused. I'm just well mixed.
  • SanderDkSanderDk Posts: 64Member
    > @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.