0

I using StructureMap for dependency resulution.

I have 2 projects

  • Project.Web (Website)
  • Project.Web.DependencyResolution (Main Registry is located here and Scanning Starts here.)

I am unable to use :

        Scan(
            scan =>
            {
                scan.AssembliesFromPath("bin", AssemblyFilter);
                scan.LookForRegistries();
                });  

As this is not able to find the location and gives a Weird path for the assembly.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\project.web
\25abf8e7\23716017\assembly\dl3\7faa87f3\c3224109_5602d001
\project.Web.DependencyResolution.dll  

Why does the assembly not able to find the bin directory or the directory where the project get published/compiled ?? I have treis this using IIS and IIS Express

Any help/tips to setup this structure ?? Thanks :)

leppie
  • 115,091
  • 17
  • 196
  • 297
Ankesh
  • 4,847
  • 4
  • 38
  • 76

1 Answers1

1

Please try this way:

Scan(
      scan =>
       {
         scan.AssembliesFromPath(Path.GetDirectoryName((new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath)), AssemblyFilter);
         scan.LookForRegistries();
        });  
alekseevi15
  • 1,732
  • 2
  • 16
  • 20
  • Great Thanks!! Your Tip helped Althought `scan.AssembliesFromPath( Path.GetDirectoryName((new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath)), AssemblyFilter);` I have to add changes to correct the URI path... but the `Codebase` thing totally slipped out of my mind, You can update the answer – Ankesh Nov 17 '14 at 13:42