From 7800ab9b429b793ee2f524f3cdabf508df6d7779 Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 19 Sep 2022 08:11:35 +0200 Subject: [PATCH] Issue #2678 --- ContainerHandling/New-NavContainer.ps1 | 12 +++++++++--- Misc/Download-Artifacts.ps1 | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ContainerHandling/New-NavContainer.ps1 b/ContainerHandling/New-NavContainer.ps1 index 3e21d13f3..9ff1503df 100644 --- a/ContainerHandling/New-NavContainer.ps1 +++ b/ContainerHandling/New-NavContainer.ps1 @@ -2248,7 +2248,7 @@ if (-not `$restartingInstance) { New-Item -Path $dotnetAssembliesFolder -ItemType Directory -ErrorAction Ignore | Out-Null Write-Host "Creating .net Assembly Reference Folder for VS Code" - Invoke-ScriptInBcContainer -containerName $containerName -scriptblock { Param($dotnetAssembliesFolder) + Invoke-ScriptInBcContainer -containerName $containerName -scriptblock { Param($dotnetAssembliesFolder, [System.Version] $Version) $serviceTierFolder = (Get-Item "C:\Program Files\Microsoft Dynamics NAV\*\Service").FullName @@ -2262,7 +2262,9 @@ if (-not `$restartingInstance) { if (Test-Path $mockAssembliesPath -PathType Container) { $paths += $mockAssembliesPath } - $paths += "C:\Program Files (x86)\Open XML SDK" + if ($version.Major -lt 21) { + $paths += "C:\Program Files (x86)\Open XML SDK" + } $paths | % { $localPath = Join-Path $dotnetAssembliesFolder ([System.IO.Path]::GetFileName($_)) @@ -2283,7 +2285,11 @@ if (-not `$restartingInstance) { new-item -itemtype symboliclink -path $ServiceTierAddInsFolder -name "RTC" -value (Get-Item $RtcFolder).FullName | Out-Null } } - } -argumentList (Get-BcContainerPath -containerName $containerName -path $dotnetAssembliesFolder) + + if ($version.Major -ge 21) { + Remove-Item -Path (Join-Path $dotnetAssembliesFolder 'assembly\DocumentFormat.OpenXml.dll') -Force -ErrorAction SilentlyContinue + } + } -argumentList (Get-BcContainerPath -containerName $containerName -path $dotnetAssembliesFolder), $version } if ($customConfig.ServerInstance) { diff --git a/Misc/Download-Artifacts.ps1 b/Misc/Download-Artifacts.ps1 index 4e43b0159..e1638bdf9 100644 --- a/Misc/Download-Artifacts.ps1 +++ b/Misc/Download-Artifacts.ps1 @@ -180,8 +180,9 @@ try { $prerequisiteComponents = Get-Content $prerequisiteComponentsFile | ConvertFrom-Json Write-Host "Downloading Prerequisite Components" $prerequisiteComponents.PSObject.Properties | % { + $skip = ($_.Name -eq "Prerequisite Components\Open XML SDK 2.5 for Microsoft Office\OpenXMLSDKv25.msi") -and (([System.Version]$appManifest.Version).Major -ge 21) $path = Join-Path $platformArtifactPath $_.Name - if (-not (Test-Path $path)) { + if ((-not $skip) -and (-not (Test-Path $path))) { $dirName = [System.IO.Path]::GetDirectoryName($path) $filename = [System.IO.Path]::GetFileName($path) if (-not (Test-Path $dirName)) {