Skip to content

Commit

Permalink
2.2.0 Add new webactivator:assembliesToScan app setting
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebbo committed Oct 5, 2016
1 parent d1a3630 commit 8a21247
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
10 changes: 10 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<add key="webactivator:assembliesToScan" value="Foo,Bar" />

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
Expand Down
32 changes: 22 additions & 10 deletions WebActivator/ActivationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,31 @@ private static IEnumerable<Assembly> Assemblies
{
// Cache the list of relevant assemblies, since we need it for both Pre and Post
_assemblies = new List<Assembly>();
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) { }
}
}

Expand Down
2 changes: 1 addition & 1 deletion WebActivator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
4 changes: 2 additions & 2 deletions WebActivator/Properties/WebActivator.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<package>
<metadata>
<id>$id$</id>
<title>WebActivator</title>
<version>2.1.0</version>
<title>WebActivatorEx</title>
<version>2.2.0</version>
<authors>$author$</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
Expand Down

0 comments on commit 8a21247

Please sign in to comment.