Missing assembly in buildDotnetModule buildPhase

Hi Nix`ers,

Am trying to build the Azure Pipeline Agent which is a dotnet application, it has quite some similarities with Github Runner.
Github runner is already available on nixpkgs

I have created a dependency file through nuget-to-nix and used mostly the same setup as the github-runner nix pkg.
The configure phase (restore) looks successfully, but in the build phase i get an error of a missing reference.

Error:

/build/src/src/Agent.Sdk/Util/ProcessUtil.cs(8,14): error CS0234: The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?) [/build/src/src/Agent.Sdk/Agent.Sdk.csproj]

I have set the PackageRuntime to linux-x64, cause System.Management is a Windows thing(?), it shouldn’t be called/used in the build phase? The reference is also missing in the restored csproj file in /build/src/src/Agent.Sdk/Agent.Sdk.csproj so that looks all correctly…

Tried to:

  • Remove the “using System.Management” line but it is giving me errors further down the file.
  • patch the Common.props file to only set linux params as OS and ARCH.
  • Overwriting the Agent.Sdk.csproj file in the /build/src directory with the package reference

Am stuck here; what can i do to debug this more?

My project can be found on github: GitHub - rudesome/ado-agent: Azure DevOps Agent packaged with Nix
Source project: GitHub - microsoft/azure-pipelines-agent: Azure Pipelines Agent 🚀

@rudesome did you manage to create a Azure pipeline agent package?

I just removed the references to the System.Management and finally it was building a nix package…

Next challenge was starting the agent;
so the nix build broke some stuff and now am stuck at “diagPath”, tried to do the same as on the Github agent but it is build differently, also the upstream changed a lot so probably need some rework with newer agent versions

1 Like