Skip to content

DotNET DLLs are cached poorly. #4

@rdebath

Description

@rdebath

I'm sometimes running multiple versions of BC through the same ALOps server.
This gives version mismatch errors where the client version doesn't match the server version even though the correct DLL file is given to the Import commands.

*** Add NAV-DeploymentRequestId [55367557-868f-4c89-9b11-400afa0a5ce0]
*** [POST] => [/v1.0/DeployPackage]
*** PowershellDeploy
>>PowershellDeploy
Deploy Script: [C:\Program Files\WindowsPowerShell\Modules\ALOps.ExternalDeployer\1.38\bin\PSScripts\_Deploy-ALOpsNAVApp.ps1]
>>*** Package Data File => [C:\Windows\TEMP\tmp6049.tmp.app]
>>*** ServerInstance = [DatabaseRobBC190]
>>*** ContainerId = []
>>*** Tenant = [default]
>>Use [Install-ALOpsExternalDeployer] to install [ALOps External Deployer] service.
>>*** Loading assemblies from: [C:\nav\run\databaserobbc190]
>> * App.ID        = 1fdb0e4e-82b1-4605-b4ff-86be4fe05b9c
>> * App.Name      = ZZZ Hello World
>> * App.Publisher = TVision (Temp)
>> * App.Version   = 2.0.17.0
Exception Occured: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The client version does not match the server version. You can only connect to a server with a matching version.
Client version: 19.0.29884.30666
Server version: 19.0.32956.33475
*** Operation Response: {"JobId":"02ba6ece-d5f5-48ea-a674-38abf7505f3d","Details":"The running command stopped because the preference variable \"ErrorActionPreference\" or common parameter is set to Stop: The client version does not match the server version. You can only connect to a server with a matching version.\r\nClient version: 19.0.29884.30666\r\nServer version: 19.0.32956.33475","Status":1,"ErrorCode":100}

To work around this you have to load the DLLs that DotNET gets confused by into a new clean session.
This is done in your _Deploy-ALOpsNAVApp.ps1 script replacing the two Import-Module lines that load the "Nav" DLLs with the below section.

$s = New-PSSession
Import-Module -PSSession $s -Name "$($ServiceFolder)\Microsoft.Dynamics.Nav.Apps.Management.dll" -Scope Global -Verbose:$false
Import-Module -PSSession $s -Name "$($ServiceFolder)\Microsoft.Dynamics.Nav.Management.dll" -Scope Global -Verbose:$false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions