Skip to content

Could not load file or assembly 'Microsoft.Build The system cannot find the file specified. #517

@maximilianosilva

Description

@maximilianosilva

After a long debugging process, I've isolated the issue to a FileNotFoundException that occurs inside the dependabot-updater-nuget container. It seems the container image is missing the Microsoft.Build assembly required to parse .csproj files.

Environment:
OS:* Windows
CLI Tool:* dependabot-cli (Go version, installed via go install)
Container Runtime:* Podman
Ecosystem:* NuGet

Steps to Reproduce:

  1. Create a basic .NET 8 console application.
  2. Add an outdated dependency (e.g., dotnet add package Newtonsoft.Json --version 12.0.3).
  3. Create a dependabot.yml file in the project root:
     version: 2
     updates:
       - package-ecosystem: "nuget"
         directory: "/"
         schedule:
           interval: "daily"

Command Executed:
dependabot update nuget --provider local .

Expected Behavior:
The tool should detect the outdated Newtonsoft.Json package and log a message that an update is available.

Actual Behavior:
The process fails. The logs show that after successfully starting the container, the updater throws a
System.IO.FileNotFoundException because it cannot find the Microsoft.Build assembly.

Full Log Output:

dependabot update nuget --provider local .
    cli | 2025/09/24 15:31:25 Using hostname: github.com api endpoint: https://api.github.com
    cli | 2025/09/24 15:31:25 Inserting $LOCAL_GITHUB_ACCESS_TOKEN into credentials
    cli | 2025/09/24 15:31:27 image ghcr.io/github/dependabot-update-job-proxy/dependabot-update-job-proxy:latest is already up to date
    cli | 2025/09/24 15:31:27 using image ghcr.io/github/dependabot-update-job-proxy/dependabot-update-job-proxy:latest at sha256:134b804c910426d5d5173c8e7f567bc1776f62c922bd39ae3db0b4d09e8821b7
    cli | 2025/09/24 15:31:30 image ghcr.io/dependabot/dependabot-updater-nuget is already up to date
    cli | 2025/09/24 15:31:30 using image ghcr.io/dependabot/dependabot-updater-nuget at sha256:1bc13ff32da65b9505044a29304b376e0adbb7266f575ad6cb0fa093f2f31f41
  proxy | 2025/09/24 15:31:32 proxy starting, commit: 32f72c93e3b014db177b94dcad54e96d6e241a4a
  proxy | 2025/09/24 15:31:32 Listening (:1080)
updater | Updating certificates in /etc/ssl/certs...
updater | rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL
updater | 1 added, 0 removed; done.
updater | Running hooks in /etc/ca-certificates/update.d...
updater | done.
updater | Job: {
updater |   "command": "update",
updater |   "package-manager": "nuget",
updater |   "allowed-updates": [
updater |     {
updater |       "update-type": "all"
updater |     }
updater |   ],
updater |   "debug": false,
updater |   "dependency-groups": [],
updater |   "dependencies": null,
updater |   "dependency-group-to-refresh": null,
updater |   "existing-pull-requests": [],
updater |   "existing-group-pull-requests": [],
updater |   "experiments": null,
updater |   "ignore-conditions": [],
updater |   "lockfile-only": false,
updater |   "requirements-update-strategy": null,
updater |   "security-advisories": [],
updater |   "security-updates-only": false,
updater |   "source": {
updater |     "provider": "local",
updater |     "repo": ".",
updater |     "directory": "/",
updater |     "hostname": "github.com",
updater |     "api-endpoint": "https://api.github.com"
updater |   },
updater |   "update-subdependencies": false,
updater |   "updating-a-pull-request": false,
updater |   "vendor-dependencies": false,
updater |   "reject-external-code": false,
updater |   "repo-private": false,
updater |   "commit-message-options": null,
updater |   "credentials-metadata": [
updater |     {
updater |       "host": "github.com",
updater |       "type": "git_source"
updater |     }
updater |   ],
updater |   "max-updater-run-time": 0,
updater |   "exclude-paths": null,
updater |   "multi-ecosystem-update": false
updater | }
updater | Unhandled exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
updater |
updater | File name: 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
updater |    at NuGetUpdater.Core.Run.ApiModel.JobErrorBase.ErrorFromException(Exception ex, String jobId, String currentDirectory)
updater |    at NuGetUpdater.Core.Clone.CloneWorker.RunAsync(Job job, String repoContentsPath) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Clone/CloneWorker.cs:line 80
updater |    at NuGetUpdater.Core.Clone.CloneWorker.RunAsync(FileInfo jobFilePath, DirectoryInfo repoContentsPath) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Clone/CloneWorker.cs:line 56
updater |    at NuGetUpdater.Cli.Commands.CloneCommand.<>c__DisplayClass4_0.<<GetCommand>b__0>d.MoveNext() in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/CloneCommand.cs:line 43
updater | --- End of stack trace from previous location ---
updater |    at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
  proxy | 2025/09/24 15:31:46 Skipping sending metrics because api endpoint is empty
  proxy | 2025/09/24 15:31:46 0/0 calls cached (0%)
    cli | 2025/09/24 15:31:48 updater failure: updater exited with code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions