From 8a21247a5bdc61af3077bafceac602a9cb236875 Mon Sep 17 00:00:00 2001 From: David Ebbo Date: Wed, 5 Oct 2016 13:11:44 -0700 Subject: [PATCH] 2.2.0 Add new webactivator:assembliesToScan app setting --- README.markdown | 10 +++++++ WebActivator/ActivationManager.cs | 32 ++++++++++++++------- WebActivator/Properties/AssemblyInfo.cs | 2 +- WebActivator/Properties/WebActivator.nuspec | 4 +-- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/README.markdown b/README.markdown index c1fe8a6..2e5a87b 100644 --- a/README.markdown +++ b/README.markdown @@ -81,6 +81,16 @@ Note that normally you would not call these methods explicitly from a web applic ## Change history +### 2.2.0 (10/5/2016) + +* Add support for `webactivator:assembliesToScan` App Setting to only scan a fixed list. + +e.g. + + + +This overrides the excludedFilesExpression flag + ### 2.1.0 (12/14/2015) * Add support for `webactivator:excludedFilesExpression` App Setting. https://github.com/davidebbo/WebActivator/issues/28 diff --git a/WebActivator/ActivationManager.cs b/WebActivator/ActivationManager.cs index 8b8bf79..a86d963 100644 --- a/WebActivator/ActivationManager.cs +++ b/WebActivator/ActivationManager.cs @@ -92,19 +92,31 @@ private static IEnumerable Assemblies { // Cache the list of relevant assemblies, since we need it for both Pre and Post _assemblies = new List(); - foreach (var assemblyFile in GetAssemblyFiles().Where(file => _fileFilter(file))) + + string assembliesToScanString = ConfigurationManager.AppSettings["webactivator:assembliesToScan"]; + if (assembliesToScanString != null) + { + foreach (string assemblyName in assembliesToScanString.Split(',')) + { + _assemblies.Add(Assembly.Load(assemblyName)); + } + } + else { - try + foreach (var assemblyFile in GetAssemblyFiles().Where(file => _fileFilter(file))) { - // Ignore assemblies we can't load. They could be native, etc... - _assemblies.Add(Assembly.LoadFrom(assemblyFile)); + try + { + // Ignore assemblies we can't load. They could be native, etc... + _assemblies.Add(Assembly.LoadFrom(assemblyFile)); + } + catch (Win32Exception) { } + catch (ArgumentException) { } + catch (FileNotFoundException) { } + catch (PathTooLongException) { } + catch (BadImageFormatException) { } + catch (SecurityException) { } } - catch (Win32Exception) { } - catch (ArgumentException) { } - catch (FileNotFoundException) { } - catch (PathTooLongException) { } - catch (BadImageFormatException) { } - catch (SecurityException) { } } } diff --git a/WebActivator/Properties/AssemblyInfo.cs b/WebActivator/Properties/AssemblyInfo.cs index 06703b5..206c808 100644 --- a/WebActivator/Properties/AssemblyInfo.cs +++ b/WebActivator/Properties/AssemblyInfo.cs @@ -34,6 +34,6 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0")] -[assembly: AssemblyFileVersion("2.1.0")] +[assembly: AssemblyFileVersion("2.2.0")] [assembly: PreApplicationStartMethod(typeof(WebActivatorEx.ActivationManager), "Run")] diff --git a/WebActivator/Properties/WebActivator.nuspec b/WebActivator/Properties/WebActivator.nuspec index cf3df33..6c2a77c 100644 --- a/WebActivator/Properties/WebActivator.nuspec +++ b/WebActivator/Properties/WebActivator.nuspec @@ -2,8 +2,8 @@ $id$ - WebActivator - 2.1.0 + WebActivatorEx + 2.2.0 $author$ false $description$