Wednesday, 24 July 2024

Net Class Library to the Azure DevOps build process

 

Net Class Library to the Azure DevOps build process


This post will show the steps to allow the Azure DevOps build pipeline to complete successfully when your Finance and Operations project references a C# library.  I ran into a build error last week on this process so I thought I would make a post for those running into the same scenario.

The error message during the build was an error that was similar to the following:

##[error]C:\DynamicsSDK\Metadata\Microsoft.Dynamics.AX.Application.Build.targets(40,5): Error MSB6006: "Xppc.exe" exited with code 2.

C:\DynamicsSDK\Metadata\Microsoft.Dynamics.AX.Application.Build.targets(40,5): error MSB6006: "Xppc.exe" exited with code 2. [C:\DynamicsSDK\Metadata\BuildMetadata.proj]Log contains 3 error messages (Showing 3):

##[error]C:\DynamicsSDK\Metadata\Microsoft.Dynamics.AX.Application.Build.targets(40,5): Error : Error: dynamics://Class/IntegrationProcessor(1,1) - The type or namespace name 'D365_DotNet_Library' could not be found (are you missing a using directive or an assembly reference?).

In my Visual Studio solution, the Finance Operations project had a reference to the C# Library project. When you add a reference to the C# library project from the Finance Operations project, the assembly is automatically added to the References node for the model associated to the Finance Operations project like the following example. 

The "D365 FO Objects" project has a reference to the "D365 DotNet Library" project:

VS-Solution.png

At this point I thought all was well, but the build will fail if you do not add the DLL file for the C# Library into the <Model>\Bin folder manually in source control. You can do this by adding the file using Source Control Explorer.

1. Right click the <Model> folder that is under the Metadata folder and choose "Add Items to Folder...".

Add-items-to-folder.png

2. Browse to the DLL file under the Bin folder in the K:\AosService\PackagesLocalDirectory\<Model> folder to add it to source control and check it in to source control.

add-to-source-control.png

Bin-folder.png

You may also need to add the xml file for the C# Library to source control if this was not checked in either at this point. This file is in the AxReference folder in the PackagesLocalDirectory folder (K:\AosService\PackagesLocalDirectory\<model>\<model>\AxReference.

add-AxReference.png

The build pipeline should now run successfully after you add the DLL and Reference file.  I hope this post is helpful and saves you some time if you run into this issue

No comments:

Post a Comment