WebActivatorEx global attribute breaking CI build

333 Views Asked by At

I'm attempting to use the Visual Studio Team Services CI builds, and I'm running into a problem with a Ninject class that's making a WebActivator call.

This code is executing within my NinjectWebCommon.cs: enter image description here

This builds/runs fine locally using Visual Studio. However, when I push my project to VSTS and attempt to run a build, I get this warning (which inevitably leads to the expected compilation error): enter image description here

If I comment out the global attributes shown above, the CI build succeeds.

I'm having a hard time pinpointing exactly where the problem lies. The error message is simple enough, but then what is the difference between a build in Visual Studio and VSTS that's allowing this to work in one place and not the other? I'm certain I could prevent this issue by manually placing the calls within my Global.asax, but that's not the direction I want to go -- Ninject is using WebActivator calls for a reason.

Thanks!

1

There are 1 best solutions below

1
On BEST ANSWER

Giving a definitive answer would be difficult without checking your actual project and CI process.

The problem is that on your CI server, the WebActivatorEx assembly is missing. Assuming your CI server pulls a copy of the solution down from source control, here's some things you can check:

  1. Make sure your CI server is running a nuget restore on the solution before building.
  2. In your web project, double check it's references and make sure WebActivatorEx is being referenced from a "packages\WebActivatorEx" path and not a "\bin\" path.
  3. Double check the packages.config in your web project and ensure WebActivatorEx is listed. This is how nuget knows to restore that package for that project.

If you clean your bin folders and delete your packages folder locally you will probably be able to replicate the issue on your machine.