[SOLVED] Compiler Error "DotNet is missing" in Business Central 19.3

NAVFuchs
NAVFuchs Member Posts: 77
edited 2022-06-27 in NAV Three Tier
Hi,

I try to compile the Business Central 19.3.34541.35002

The compiler ends with following errors, because dotnet libaries are not found:

d:\Projekt\UpgradeBC190\BaseAppCustomized\SMTPMail.Codeunit.al(15,28): error AL0185: DotNet 'CancellationToken' is missing
d:\Projekt\UpgradeBC190\BaseAppCustomized\SOAPWebServiceRequestMgt.Codeunit.al(364,16): error AL0185: DotNet 'Claim' is missing
d:\Projekt\UpgradeBC190\BaseAppCustomized\SOAPWebServiceRequestMgt.Codeunit.al(386,16): error AL0185: DotNet 'Claim' is missing
d:\Projekt\UpgradeBC190\BaseAppCustomized\StreamManagement.Codeunit.al(37,19): error AL0185: DotNet 'GenericIReadOnlyList1' is missing
d:\Projekt\UpgradeBC190\BaseAppCustomized\ImageAnalysisManagement.Codeunit.al(210,15): error AL0185: DotNet 'Task1' is missing
d:\Projekt\UpgradeBC190\BaseAppCustomized\Todo.Table.al(2767,62): error AL0185: DotNet 'TimeZoneInfo' is missing
d:\Projekt\UpgradeBC190\BaseAppCustomized\Todo.Table.al(2769,38): error AL0185: DotNet 'TimeZoneInfo' is missing
d:\Projekt\UpgradeBC190\BaseAppCustomized\Todo.Table.al(2780,23): error AL0185: DotNet 'TimeZoneInfo' is missing
d:\Projekt\UpgradeBC190\BaseAppCustomized\Todo.Table.al(2803,85): error AL0185: DotNet 'TimeZoneInfo' is missing
d:\Projekt\UpgradeBC190\BaseAppCustomized\TypeHelper.Codeunit.al(332,23): error AL0185: DotNet 'TimeZoneInfo' is missing
d:\Projekt\UpgradeBC190\BaseAppCustomized\TypeHelper.Codeunit.al(354,23): error AL0185: DotNet 'TimeZoneInfo' is missing
d:\Projekt\UpgradeBC190\BaseAppCustomized\TypeHelper.Codeunit.al(756,23): error AL0185: DotNet 'TimeZoneInfo' is missing

I addes to my dotnet.al file following entry, but something seems to be incorrect

assembly("System")
{
Version = '4.0.0.0';
Culture = 'neutral';
PublicKeyToken = "b77a5c561934e089";
type("System.TimeZoneInfo")
{

}


It is not clear to me how to declare all these DotNet, so that these errors disappear.



Best regards,

Markus

Answers

  • NAVFuchs
    NAVFuchs Member Posts: 77
    I tried this already, but it seems to be wrong.

    dotnet
    {

    assembly("System")
    {
    Version = '4.0.0.0';
    Culture = 'neutral';
    PublicKeyToken = 'b77a5c561934e089';
    type("System.TimeZoneInfo")
    {

    }
    type("System.Threading.CancellationToken")
    { }
    }
    }

    .NET Type "System.TimeZoneInfo"
    The type 'System.TimeZoneInfo' could not be found in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'ALAL0452


    .NET Type "System.Threading.CancellationToken"
    The type 'System.Threading.CancellationToken' could not be found in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'ALAL0452

  • Developer101
    Developer101 Member Posts: 569
    Have you provided the path to the assemblies in the VS Code's user settings?

    United Kingdom
  • NAVFuchs
    NAVFuchs Member Posts: 77
    I have defined following path:

    h9sjnjdbc4qr.jpg

    ./.netpackages
    C:/Program Files/Assemblies
    C:\Program Files\Microsoft Dynamics 365 Business Central\190\Service\Add-ins
    C:\Windows\assembly

  • Developer101
    Developer101 Member Posts: 569
    try in each al object add dotnet {} reference
    United Kingdom
  • NAVFuchs
    NAVFuchs Member Posts: 77
    But this cannot be the solution. This is the base application of bc190.
  • Developer101
    Developer101 Member Posts: 569
    ah ok , I thought it was your customised app. if it is a base app then this is weird.
    United Kingdom
  • joerg_renz
    joerg_renz Member Posts: 29
    Hello,
    have you already found a solution for this problem?
    I currently want to prepare a technical upgrade from BC19 to BC20 as described here: https://docs.microsoft.com/de-de/dynamics365/business-central/dev-itpro/upgrade/upgrade-technical-upgrade-v20
    This also requires a small adjustment in the Base App from Microsoft.

    I then received this information from a Microsoft support employee:
    Basically, aside the BC assemblies, what is needed to be referenced in the assembly path are:
    1. .NET Framework (19.x was built with 4.7x.
    2. OpenXML 2.5 library (this can be downloaded as nuget package)
    3. PowerShell management library (this is used only by one object)

    For the last two items I got a zip package from Microsoft.

    In settings.json should be the following entries:

    "al.assemblyProbingPaths": [
    "C:\LIBS\",
    "C:\Program Files\Microsoft Dynamics 365 Business Central\190",
    "C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\\190\RoleTailored Client",
    "C:\Windows\\Microsoft.NET\Framework64",
    "C:\Program Files (x86)\Reference Assemblies\\Microsoft\WindowsPowerShell\3.0"
    ], ...

    However, I am currently unable to compile the Base App.
    It would be interesting for me to know if you can compile the Base App and what settings you made for it.

  • NAVFuchs
    NAVFuchs Member Posts: 77
    Hello,

    at the moment I haven't solved the problem. As you told, that 19.x ist built with 4.7.x, I
    checked out my installed versions:

    Currently installed "classic" .NET Versions in the system:
    2.0.50727.4927 Service Pack 2
    3.0.30729.4926 Service Pack 2
    3.5.30729.4926 Service Pack 1
    4.0.0.0
    4.8.04084

    I got this information with a tool. But when I open "Apps and Features", it shows me,
    that .NET Framework 4.7.1 SDK is installed.





  • joerg_renz
    joerg_renz Member Posts: 29
    Hello,
    I have solved my problem in the meantime.
    I referenced a directory from a Docker image in the settings (settings.json) in the section "al.assemblyProbingPaths".
    I created the Docker image with BcContainerHelper.
    Here is the relevant section from settings.json:

    "al.assemblyProbingPaths": [
    "C:/LIBS/",
    "./.netpackages",
    "C:/ProgramData/BcContainerHelper/Extensions/bc193onprem/.netpackages/",
    "C:/Program Files/Microsoft Dynamics 365 Business Central/190/Service",
    "C:/Windows/Microsoft.NET/Framework64",
    "C:/Program Files (x86)/Reference Assemblies/Microsoft/WindowsPowerShell/3.0"
    ]
  • NAVFuchs
    NAVFuchs Member Posts: 77
    Hi,
    I installed now an image with BCContainerhelpers, but I could not find the .netpackages directory in the C:/ProgramData/BcContainerHelper/Extensions...

    BC is running in Container.

    Could the .netpackages be installed elsewhere?
  • joerg_renz
    joerg_renz Member Posts: 29
    Hi,
    did you look for .netPackages-Directory here:
    C:/ProgramData/BcContainerHelper/Extensions/<Containername>/.netPackages?
  • NAVFuchs
    NAVFuchs Member Posts: 77
    yes, I looked in:

    C:\ProgramData\BcContainerHelper\Extensions\mysandbox

    There is only a directory called:

    C:\ProgramData\BcContainerHelper\Extensions\mysandbox\my
  • joerg_renz
    joerg_renz Member Posts: 29
    did you create a powershell script for creating your container?
    could you show us this script?
  • NAVFuchs
    NAVFuchs Member Posts: 77
    I have used this one:

    $artifactUrl = Get-BcArtifactUrl -type sandbox -country us -select Latest
    New-BCContainer -accept_eula -containerName mysandbox -artifactUrl $artifactUrl
  • joerg_renz
    joerg_renz Member Posts: 29
    could you try to create a new container with this script:

    $artifactUrl = Get-BcArtifactUrl -type sandbox -country us -select Latest
    New-BCContainer -accept_eula -containerName mysandbox -artifactUrl $artifactUrl -includeAL -doNotExportObjectsToText
  • joerg_renz
    joerg_renz Member Posts: 29
    change containername "mysandbox" to "mynewsandbox"
  • NAVFuchs
    NAVFuchs Member Posts: 77
    Thanks a lot for this great help! it works, the package could be compiled successully.