web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Class library dlls aren't beeing found in Azure Devops Hosted Agent Pipeline Execution

(0) ShareShare
ReportReport
Posted on by 216

Hi, Community!!

I'm making some tests here, trying to use Azure Hosted Agent to compile and packing my branch code.

Then I made a solution with all my X++ projects and the thing is compiling well using the build order of the models. But as I have some class library dlls, some projects references the packageslocaldirectory's bin folder and it's beeing a problem, because the compiler aren't getting there. I receive errors like the one below:

"##[error]D:\a\8\NuGets\Microsoft.Dynamics.AX.Platform.CompilerPackage\DevAlm\Microsoft.Dynamics.Framework.Tools.BuildTasks.targets(46,5): Error : Error: dynamics://Class/NameOfClass(2,1) - The type or namespace name 'DLLREFERENCE.NAMESPACE' could not be found (are you missing a using directive or an assembly reference?)."


Someone could help me on how to solve this problem?

Thanks in advance!

I have the same question (0)
  • WillWU Profile Picture
    22,361 on at

    Hi Otavio Anaga,

    Please try to add the class library dlls into the <model>\bin folder manually in source control.

    If it doesn't work , you may need to add the xml file for the library to source control.

    Refer to the article:community.dynamics.com/.../adding-a-customer-or-3rd-party-c-library-to-azure-devops-for-the-build-process

  • Otavio Anaga Profile Picture
    216 on at

    Hi Will WU,

    These two files, dll and XML, already was

    in my repository. I saw your link but the problem there is with pipeline using build server, not azure hosted agent.

    But thank you very much for your answer!

  • Verified answer
    Otavio Anaga Profile Picture
    216 on at

    I found a workaround. The problem is that X++ projects references the dll with a local filename. Then when MSBuild tries to find the DLL, it can't find anything because the build directory is totally different from my local VM.

    Then to workaround the problem, I went to my X++ project, changed the DLL reference path to packageslocaldirectory's bin folder, and then I made a build of this project.

    After that, I went to my project file (through "open folder in file expolorer" button, on project's right click) and put a line like the one bellow: (near to BuildTasksDirectory tag)

        <MetadataDirectory Condition=" '$(MetadataDirectory)' == '' ">C:\AOSService\PackagesLocalDirectory</MetadataDirectory>

    It gonna say to my compiler `if you don't receive a parameter to "MetadaDirectory", then assume that it's value gonna be C:\AOSService\PackagesLocalDirectory `. When we do build through devops hosted agent, it assigns a value to this parameter, then the compiler gonna assume my local path when I run build through my machine and the hosted agent path when called from devops pipeline.

    The other change that I made was in DLL HintPath property:

    <HintPath>$(MetadataDirectory)\[PACKAGENAME]\bin\[DLLNAME].dll</HintPath>


    With that, my build hosted agent pipeline found my class library dll!!

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at

    I'm a bit confused by the details on this thread, and would like to understand it so we can make sure this scenario works as expected out of the box...

    The new build definition used for hosted agents, passes reference folders to msbuild (and ultimately the X++ compiler) which are meant exactly for this. For most scenarios these should be perfectly fine, so I would like to understand some details. For more advanced scenarios, you can add any reference folders to the msbuild step in the definition. I hope that you can avoid adding anything to the project as far as properties like what you're doing.

    That said, what's confusing me is that you seem to be setting a default to support building outside of the hosted agents, implying that the hosted agent works fine? But your original post seems to talk about an error with the hosted build.

    If you'd prefer to take this offline I'm happy to start an email thread or even a quick meeting to understand your scenario and issue.

  • Otavio Anaga Profile Picture
    216 on at

    Hi Joris!

    Sorry about the confusing text haha

    Sure, just let me create a new clean enviroment here and then I show you the problem. I saw that you are a connection on my linkedin then we can talk through there. 

    Thanks for your time.

  • steen.rabol Profile Picture
    134 on at

    I have the same issue, what was the solution ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 499 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans