Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

Background worker missing referenced nuget assembly at runtime

Joel Mello's Avatar

Joel Mello

May 06, 2014 @ 11:42 AM

Hey guys,

tl;dr: Occasional issue with Autofac nuget package not getting pulled in correctly causing runtime File Not Found exception on my background worker. I have a workaround below.

Occasionally I will see this in the Logger right after a build:

2014-05-06T10:55:25.970+00:00 app worker.1 nightlife.Scheduler.exe: Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Autofac, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
2014-05-06T10:55:25.970+00:00 app worker.1 nightlife.Scheduler.exe: at nightlife.Scheduler.Program.Main(String[] args)
2014-05-06T10:55:33.146+00:00 app worker.1 ProcessManager: Process "nightlife.Scheduler.exe" was terminated with exit code "-2147467259"

It's always been for the Autofac nuget reference inside my Scheduler (background worker). I am unable to reproduce this issue locally and the AppHarbor build logs seem to show all nuget things working correctly.

When this started happening, I first tried uninstall-package then install-package the Autofac nuget package from my background worker project (Scheduler) and commit again. This never fixed it. I have 12 projects in my solution, 3 of which have an Autofac nuget dependency. Only 2 are actually deployed on AppHarbor (webapi project and 1 console app project). I found that if I go to each Autofac dependent project and do a uninstall-package then install-package again, it will fix the issue on the next commit. Maybe an issue with my Git/Bitbucket checkin?

This will happen randomly during my development process, maybe once every few days.

I referenced previous ticket: http://support.appharbor.com/discussions/problems/27156-missing-ass... but it doesn't apply here. My packages are stored at .sln level.

Here's a build log from a failing deployment (fd070f3e8338d02eb29bd029500a801befc2b59d)

https://appharbor-logs.s3.amazonaws.com/50/4e0544-2d39-44c8-bf53-a2...

The next deployment failed also (ab56012d219949c9e6bcc925d9416993d60a784d)

But I solved it using the uninstall/install package manager console trick on deployment 3 (755a86263eecfff77a645e202f0e3bb1f9bb7ff3)

Any tips to help prevent this in the future?

Thanks for a great service - Joel

  1. Support Staff 1 Posted by rune on May 07, 2014 @ 02:01 AM

    rune's Avatar

    Hi Joel,

    Looks like the web project is referencing another version of Autofac than the two other references. Updating that will likely resolve the issue.

    You might want to get rid of the packages directory altogether and instead rely on AppHarbor's integrated NuGet package restore. This will not only reduce the footprint and growth of your repository over time, but also make dependency version issues such as this easier to identify and resolve in the future.

    Let me know if this doesn't help!

    Best,
    Rune

  2. rune closed this discussion on May 07, 2014 @ 02:01 AM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac