Cannot compile custom AutofacNancyBootstrapper with ScriptCs on Mac

222 Views Asked by At

I'm struggling to compile the following file Bootstrapper.csx on the latest version ScriptCs (v0.14.0) on MacOSX:

using Autofac;
using Nancy.Bootstrappers.Autofac;

public class Bootstrapper : AutofacNancyBootstrapper
{
    private readonly ILifetimeScope _lifetimeScope;

    public Bootstrapper(ILifetimeScope lifetimeScope)
    {
        _lifetimeScope = lifetimeScope;
    }

    protected override ILifetimeScope GetApplicationContainer()
    {
        return _lifetimeScope;
    }
}

It produces the following error:

(15,39): error CS0508: `Bootstrapper.GetApplicationContainer()':
return type must be `Autofac.ILifetimeScope' to match overridden member
`Nancy.Bootstrappers.Autofac.AutofacNancyBootstrapper.GetApplicationContainer()'
/Users/tnt/Development/GitHub/scriptcs-gulp-nancyfx/scriptcs_packages
/Nancy.Bootstrappers.Autofac.1.1/lib/net40/Nancy.Bootstrappers.Autofac.dll
(Location of the symbol related to previous error)

My scriptcs_packages.config is as follows:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Autofac" version="3.5.2" targetFramework="net40" />
  <package id="Nancy" version="1.1" targetFramework="net40" />
  <package id="Nancy.Bootstrappers.Autofac" version="1.1" targetFramework="net40" />
  <package id="Nancy.Hosting.Self" version="1.1" targetFramework="net40" />
</packages>

I have based the code from this example so I suspect it should work:

How to use Autofac to resolve instance per request dependencies for types in a child lifetime scope created by Nancy

I apologise in advance if I am doing something really obvious wrong but I just can't see it...

Update:

Followed the process outline in Adam Ralph's first comment and it still fails (on MacOSX) as follows:

iTerm screen of it failing on MacOSX

0

There are 0 best solutions below