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 :)

1 Answer 1

1

Please try this way:

Scan(
      scan =>
       {
         scan.AssembliesFromPath(Path.GetDirectoryName((new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath)), AssemblyFilter);
         scan.LookForRegistries();
        });  
Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.