Skip to content

Commit 63f8f8e

Browse files
authored
Load Analyzers\Microsoft.Dynamics.Nav.Analyzers.Common.dll when analyzers are enabled (#3920)
Issue on BCApps: https://github.com/microsoft/BCApps/actions/runs/14808100532/job/41579351870?pr=3632 > AL1003 An instance of analyzer Microsoft.Dynamics.Nav.CodeCop.Design.PermissionSetExtensionsShouldNotIncludePermissionsForObjectsFromDifferentApplication cannot be created from C:\ProgramData\BcContainerHelper\compiler\1fd7c862-d6e2-4d8e-8d0b-e2ab8f172466\compiler\extension\bin\Analyzers\Microsoft.Dynamics.Nav.CodeCop.dll : Could not load file or assembly 'Microsoft.Dynamics.Nav.Analyzers.Common, Version=16.0.22.33136, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
1 parent 9bc1f5f commit 63f8f8e

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

AppHandling/Compile-AppInNavContainer.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,15 @@ try {
648648
if ($GenerateReportLayoutParam) {
649649
$alcParameters += @($GenerateReportLayoutParam)
650650
}
651+
652+
# Microsoft.Dynamics.Nav.Analyzers.Common.dll needs to referenced first, as this is how the analyzers are loaded
653+
if ($EnableCodeCop -or $EnableAppSourceCop -or $EnablePerTenantExtensionCop -or $EnableUICop) {
654+
$analyzersCommonDLLPath = Join-Path $binPath 'Analyzers\Microsoft.Dynamics.Nav.Analyzers.Common.dll'
655+
if (Test-Path $analyzersCommonDLLPath) {
656+
$alcParameters += @("/analyzer:$(Join-Path $binPath 'Analyzers\Microsoft.Dynamics.Nav.Analyzers.Common.dll')")
657+
}
658+
}
659+
651660
if ($EnableCodeCop) {
652661
$alcParameters += @("/analyzer:$(Join-Path $binPath 'Analyzers\Microsoft.Dynamics.Nav.CodeCop.dll')")
653662
}

CompilerFolderHandling/Compile-AppWithBcCompilerFolder.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ try {
352352
$alcExe = 'alc'
353353
$alcCmd = "./$alcExe"
354354
}
355-
}
355+
}
356356

357357
if (!(Test-Path -Path (Join-Path $alcPath $alcExe))) {
358358
$alcCmd = "dotnet"
@@ -367,6 +367,15 @@ try {
367367
if ($GenerateReportLayoutParam) {
368368
$alcParameters += @($GenerateReportLayoutParam)
369369
}
370+
371+
# Microsoft.Dynamics.Nav.Analyzers.Common.dll needs to referenced first, as this is how the analyzers are loaded
372+
if ($EnableCodeCop -or $EnableAppSourceCop -or $EnablePerTenantExtensionCop -or $EnableUICop) {
373+
$analyzersCommonDLLPath = Join-Path $binPath 'Analyzers\Microsoft.Dynamics.Nav.Analyzers.Common.dll'
374+
if (Test-Path $analyzersCommonDLLPath) {
375+
$alcParameters += @("/analyzer:$(Join-Path $binPath 'Analyzers\Microsoft.Dynamics.Nav.Analyzers.Common.dll')")
376+
}
377+
}
378+
370379
if ($EnableCodeCop) {
371380
$alcParameters += @("/analyzer:$(Join-Path $binPath 'Analyzers\Microsoft.Dynamics.Nav.CodeCop.dll')")
372381
}

ReleaseNotes.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
6.1.5
22
Include AuthContext and Environment in Parameters for InstallMissingDependencies when called from Run-AlPipeline
33
AL-Go issue 1695 Fail early if app.json cannot be read
4+
Issue with BC artifact 27.0.33668.0: app compilation fails because of analyzers not being loaded properly
45

56
6.1.4
67
Issue 3882 Run-AlPipeline with CompilerFolder and Container defined fails when running tests
@@ -102,7 +103,7 @@ Include AI Toolkit when copying symbols from container
102103
Issue 3714 Download-BcNuGetPackageToFolder - throws error when use "-select Exact"
103104
Issue 3621 New-AadAppsForBc shows "-includeEmailAadApp is deprecated. Use -includeOtherServicesAadApp instead." but includeOtherServicesAadApp us not setting email permissions
104105
Issue 3718 Business Central Web Client Fails to Load After Updating to Windows 24H2
105-
Issue #3703 Missing Function Download-BcEnvironmentInstalledExtensionToFolder
106+
Issue #3703 Missing Function Download-BcEnvironmentInstalledExtensionToFolder
106107
Fix for issue 1262 in AL-Go for GitHub
107108
Fix instabilities during Publish-PerTenantExtensionApps
108109

0 commit comments

Comments
 (0)