0

I want log my SSIS 2008 using enterprise library logging 5 so I created a class library project, added all enterprise library logging dependencies and wrote a compatible App.Config. I validated that everything OK with my logger library by creating a console application, add my logger library as reference and started logging using it - everything worked without a problem.

Now, When I do the same process on my SSIS project (inside script task) I'm getting the following error:

Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type LogWriter, key "" ---> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type LogWriter cannot be constructed. You must configure the container to supply this value.
-----------------------------------------------
At the time of the exception, the container was:

  Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter,(none)
 ---> System.InvalidOperationException: The type LogWriter cannot be constructed. You must configure the container to supply this value.
   at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.GuardTypeIsNonPrimitive(IBuilderContext context, SelectedConstructor selectedConstructor)
   at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext context)
   at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
   at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey)
   at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
   at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides)
   at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides)
   at Microsoft.Practices.Unity.UnityServiceLocator.DoGetInstance(Type serviceType, String key)
   at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
   at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService]()
   at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.get_Writer()
   at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(LogEntry log)
   at ClaimRoomSSIS_SharedCode.Utilities.Logger.Debug(String msg, Module module)
   at ST_a3e0b574a8964ffb8af6f9fee31d5afd.csproj.ScriptMain.Main()

I'm not understanding this, I did everything I could think about:

  1. reference my logger library
  2. add to my script task App.Config with same content as the App.Config that I tried before.
  3. Checking that my script task and class library works under same framework version

Usually this error related to App.Config issues but I took exactly same App.Config from my Tester project so I'm not sure why it still happen.

Do you have any idea how can I solve it?

Ofir
  • 5,049
  • 5
  • 36
  • 61

0 Answers0