cli icon indicating copy to clipboard operation
cli copied to clipboard

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

Open maximilianosilva opened this issue 5 months ago • 1 comments

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

maximilianosilva avatar Sep 24 '25 15:09 maximilianosilva

Same error... :(

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": "github",
updater |     "repo": "",
updater |     "directories": [
updater |       "src"
updater |     ],
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 |   "max-updater-run-time": 0,
updater |   "exclude-paths": null,
updater |   "multi-ecosystem-update": false
updater | }
updater | Git repository already exists, skipping clone.
updater | Currently installed SDKs: 8.0.412 9.0.302
updater | 8.0.412 [/usr/local/dotnet/current/sdk]
updater | 9.0.302 [/usr/local/dotnet/current/sdk]
updater | User-level NuGet.Config set to ...
updater | <?xml version="1.0" encoding="utf-8"?>
updater | <configuration>
updater |   <packageSources>
updater |     <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
updater |   </packageSources>
updater | </configuration>
updater | Base commit SHA: b0342f342eee56d0721e1b2836c2ec13b6cc7497
updater | 2025/10/07 14:33:47 INFO Starting update job of type group_update_all_versions
  proxy | 2025/10/07 14:33:47 [001] POST http://host.docker.internal:36015/update_jobs/cli/increment_metric
  proxy | 2025/10/07 14:33:47 [001] No response from server
  proxy | 2025/10/07 14:33:47 Received nil response
  proxy | 2025/10/07 14:33:47 [001] No response from server
  proxy | 2025/10/07 14:33:47 Received nil response
  proxy | 2025/10/07 14:33:56 [002] POST http://host.docker.internal:36015/update_jobs/cli/increment_metric
  proxy | 2025/10/07 14:33:56 [002] No response from server
  proxy | 2025/10/07 14:33:56 Received nil response
  proxy | 2025/10/07 14:33:56 [002] No response from server
  proxy | 2025/10/07 14:33:56 Received nil response
  proxy | 2025/10/07 14:34:00 [003] POST http://host.docker.internal:36015/update_jobs/cli/increment_metric
  proxy | 2025/10/07 14:34:00 [003] No response from server
  proxy | 2025/10/07 14:34:00 Received nil response
  proxy | 2025/10/07 14:34:00 [003] No response from server
  proxy | 2025/10/07 14:34:00 Received nil response
  proxy | 2025/10/07 14:34:03 [004] POST http://host.docker.internal:36015/update_jobs/cli/increment_metric
  proxy | 2025/10/07 14:34:03 [004] No response from server
  proxy | 2025/10/07 14:34:03 Received nil response
  proxy | 2025/10/07 14:34:03 [004] No response from server
  proxy | 2025/10/07 14:34:03 Received nil response
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.Run.RunWorker.RunScenarioHandlersWithErrorHandlingAsync(Job job, DirectoryInfo repoContentsPath, DirectoryInfo caseInsensitiveRepoContentsPath, String baseCommitSha, ExperimentsManager experimentsManager) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs:line 80
updater |    at NuGetUpdater.Core.Run.RunWorker.RunAsync(Job job, DirectoryInfo repoContentsPath, DirectoryInfo caseInsensitiveRepoContentsPath, String baseCommitSha, ExperimentsManager experimentsManager) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs:line 53
updater |    at NuGetUpdater.Core.Run.RunWorker.RunAsync(FileInfo jobFilePath, DirectoryInfo repoContentsPath, DirectoryInfo caseInsensitiveRepoContentsPath, String baseCommitSha, FileInfo outputFilePath) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs:line 48
updater |    at NuGetUpdater.Cli.Commands.RunCommand.<>c.<<GetCommand>b__7_0>d.MoveNext() in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs:line 56
updater | --- End of stack trace from previous location ---
updater |    at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
  proxy | 2025/10/07 14:34:05 Skipping sending metrics because api endpoint is empty
  proxy | 2025/10/07 14:34:05 0/0 calls cached (0%)
    cli | 2025/10/07 14:34:06 updater failure: updater exited with code 1

I see this workaroung https://github.com/dependabot/dependabot-core/issues/11455 but no experiments arguments is available to pass via cli command.. :(

Please help!

eduardojimenez-fst avatar Oct 06 '25 14:10 eduardojimenez-fst