1

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

Community
  • 1
  • 1
Tod Thomson
  • 4,773
  • 2
  • 33
  • 33
  • Note: I don't have a Windows machine (on me) so I can't test it in Windows to see if it works there (but I will be able to do that tomorrow)... – Tod Thomson Mar 26 '15 at 10:53
  • I'm afraid I can't reproduce this with 0.14.0. The code compiles just fine using both the Roslyn engine and the mono engine (note that I am on Windows). Do you have anything else in your folder which may be interfering? I created a new folder, added just the packages file you posted and the class you posted in a csx file. – Adam Ralph Mar 26 '15 at 12:25
  • I just created a fresh folder with two new files and c&p my code from above into those and ran `scriptcs bootstrapper.csx` and it's still failing ;( (see the screen shot above) – Tod Thomson Mar 26 '15 at 12:46
  • 1
    OK, I guess the issue may be a little deeper. I've raised https://github.com/scriptcs/scriptcs/issues/1004 so that the core team can track it. We'll cross post back here once an answer is found. – Adam Ralph Mar 27 '15 at 16:31

0 Answers0