diff --git a/Directory.Build.props b/Directory.Build.props
index cffe01b760..d913619aa9 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -14,9 +14,6 @@
$(MSBuildThisFileDirectory)
$(MSBuildThisFileDirectory)build\Key.snk
true
- Microsoft
- MicrosoftNuGet
- true
true
false
diff --git a/run.sh b/run.sh
index 61f7a53385..4c1fed5646 100755
--- a/run.sh
+++ b/run.sh
@@ -220,7 +220,7 @@ if [ -f "$config_file" ]; then
config_channel="$(jq -r 'select(.channel!=null) | .channel' "$config_file")"
config_tools_source="$(jq -r 'select(.toolsSource!=null) | .toolsSource' "$config_file")"
else
- _error "$config_file contains invalid JSON."
+ __error "$config_file contains invalid JSON."
exit 1
fi
elif __machine_has python ; then
@@ -228,7 +228,7 @@ if [ -f "$config_file" ]; then
config_channel="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")"
config_tools_source="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")"
else
- _error "$config_file contains invalid JSON."
+ __error "$config_file contains invalid JSON."
exit 1
fi
elif __machine_has python3 ; then
@@ -236,11 +236,11 @@ if [ -f "$config_file" ]; then
config_channel="$(python3 -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")"
config_tools_source="$(python3 -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")"
else
- _error "$config_file contains invalid JSON."
+ __error "$config_file contains invalid JSON."
exit 1
fi
else
- _error 'Missing required command: jq or python. Could not parse the JSON file.'
+ __error 'Missing required command: jq or python. Could not parse the JSON file.'
exit 1
fi
diff --git a/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs b/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs
index 9ebc1e5a8b..8c104068d6 100644
--- a/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs
+++ b/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs
@@ -162,13 +162,6 @@ namespace Microsoft.AspNetCore.Hosting
}
}
- var logger = hostingServiceProvider.GetRequiredService>();
- // Warn about duplicate HostingStartupAssemblies
- foreach (var assemblyName in _options.GetFinalHostingStartupAssemblies().GroupBy(a => a, StringComparer.OrdinalIgnoreCase).Where(g => g.Count() > 1))
- {
- logger.LogWarning($"The assembly {assemblyName} was specified multiple times. Hosting startup assemblies should only be specified once.");
- }
-
AddApplicationServices(applicationServices, hostingServiceProvider);
var host = new WebHost(
@@ -181,6 +174,14 @@ namespace Microsoft.AspNetCore.Hosting
{
host.Initialize();
+ var logger = host.Services.GetRequiredService>();
+
+ // Warn about duplicate HostingStartupAssemblies
+ foreach (var assemblyName in _options.GetFinalHostingStartupAssemblies().GroupBy(a => a, StringComparer.OrdinalIgnoreCase).Where(g => g.Count() > 1))
+ {
+ logger.LogWarning($"The assembly {assemblyName} was specified multiple times. Hosting startup assemblies should only be specified once.");
+ }
+
return host;
}
catch
@@ -196,7 +197,7 @@ namespace Microsoft.AspNetCore.Hosting
var provider = collection.BuildServiceProvider();
var factory = provider.GetService>();
- if (factory != null)
+ if (factory != null && !(factory is DefaultServiceProviderFactory))
{
using (provider)
{