dotnet.al compile error system.xml

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

Best Answer

  • TallyHoTallyHo Member Posts: 417
    edited 2018-12-07 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 :/

Answers

  • SanderDkSanderDk Member Posts: 502
    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?
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • TallyHoTallyHo Member Posts: 417
    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"
  • SanderDkSanderDk Member Posts: 502
    Try:
    bvbcbxdhfnux.png
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • TallyHoTallyHo Member Posts: 417
    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.
  • TallyHoTallyHo Member Posts: 417

    tpap1hdxhnrf.jpg
  • TallyHoTallyHo Member Posts: 417
    5v2z1bvml2gs.jpg
  • TallyHoTallyHo Member Posts: 417
    At last..

    5f7ymk2xiefs.png
  • TallyHoTallyHo Member Posts: 417
    edited 2018-12-07 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 :/
  • SanderDkSanderDk Member Posts: 502
    > @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 :)
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
Sign In or Register to comment.