bool ExecuteExtensions()
        {
            ResolveAssemblyHelper resolveAssemblyHelper = new ResolveAssemblyHelper(XamlBuildTaskServices.GetReferences(this.References));

            AppDomain.CurrentDomain.AssemblyResolve += resolveAssemblyHelper.ResolveLocalProjectReferences;

            bool extensionExecutedSuccessfully = true;

            try
            {
                IEnumerable <IXamlBuildTypeInspectionExtension> extensions =
                    XamlBuildTaskServices.GetXamlBuildTaskExtensions <IXamlBuildTypeInspectionExtension>(
                        this.XamlBuildTaskTypeInspectionExtensionNames,
                        this.BuildLogger,
                        this.MSBuildProjectDirectory);

                foreach (IXamlBuildTypeInspectionExtension extension in extensions)
                {
                    try
                    {
                        extensionExecutedSuccessfully &= extension.Execute(this.BuildContextForExtensions);
                    }
                    catch (FileNotFoundException e)
                    {
                        throw FxTrace.Exception.AsError(new LoggableException(SR.ExceptionThrownInExtension(extension.ToString(), e.GetType().ToString(), SR.AssemblyNotFound(ResolveAssemblyHelper.FileNotFound))));
                    }
                    catch (Exception e)
                    {
                        if (Fx.IsFatal(e))
                        {
                            throw;
                        }
                        throw FxTrace.Exception.AsError(new LoggableException(SR.ExceptionThrownInExtension(extension.ToString(), e.GetType().ToString(), e.Message)));
                    }
                }
                if (!this.BuildLogger.HasLoggedErrors && extensionExecutedSuccessfully)
                {
                    foreach (string file in this.BuildContextForExtensions.GeneratedFiles)
                    {
                        this.GeneratedCodeFiles.Add(file);
                    }
                }
            }
            finally
            {
                AppDomain.CurrentDomain.AssemblyResolve -= resolveAssemblyHelper.ResolveLocalProjectReferences;
            }
            return(extensionExecutedSuccessfully);
        }
        bool ExecuteExtensions()
        {
            ResolveAssemblyHelper resolveAssemblyHelper = new ResolveAssemblyHelper(XamlBuildTaskServices.GetReferences(this.References));
            AppDomain.CurrentDomain.AssemblyResolve += resolveAssemblyHelper.ResolveLocalProjectReferences;

            bool extensionExecutedSuccessfully = true;
            try
            {                
                IEnumerable<IXamlBuildTypeInspectionExtension> extensions =
                    XamlBuildTaskServices.GetXamlBuildTaskExtensions<IXamlBuildTypeInspectionExtension>(
                    this.XamlBuildTaskTypeInspectionExtensionNames,
                    this.BuildLogger,
                    this.MSBuildProjectDirectory);                

                foreach (IXamlBuildTypeInspectionExtension extension in extensions)
                {
                    try
                    {
                        extensionExecutedSuccessfully &= extension.Execute(this.BuildContextForExtensions);
                    }
                    catch (FileNotFoundException e)
                    {
                        throw FxTrace.Exception.AsError(new LoggableException(SR.ExceptionThrownInExtension(extension.ToString(), e.GetType().ToString(), SR.AssemblyNotFound(ResolveAssemblyHelper.FileNotFound))));
                    }
                    catch (Exception e)
                    {
                        if (Fx.IsFatal(e))
                        {
                            throw;
                        } 
                        throw FxTrace.Exception.AsError(new LoggableException(SR.ExceptionThrownInExtension(extension.ToString(), e.GetType().ToString(), e.Message)));
                    }
                }
                if (!this.BuildLogger.HasLoggedErrors && extensionExecutedSuccessfully)
                {
                    foreach (string file in this.BuildContextForExtensions.GeneratedFiles)
                    {
                        this.GeneratedCodeFiles.Add(file);
                    }
                }
            }
            finally
            {
                AppDomain.CurrentDomain.AssemblyResolve -= resolveAssemblyHelper.ResolveLocalProjectReferences;
            }
            return extensionExecutedSuccessfully;
        }