From 2690da8452c9581cc0cbe2686ace75ba3856a2ad Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Fri, 1 Jul 2016 10:54:16 -0700 Subject: [PATCH] Update --- .../EmbeddedFileProvider.cs | 15 ++++++++++++--- .../project.json | 4 +++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.Extensions.FileProviders.Embedded/EmbeddedFileProvider.cs b/src/Microsoft.Extensions.FileProviders.Embedded/EmbeddedFileProvider.cs index 988b2f6f..35a37421 100644 --- a/src/Microsoft.Extensions.FileProviders.Embedded/EmbeddedFileProvider.cs +++ b/src/Microsoft.Extensions.FileProviders.Embedded/EmbeddedFileProvider.cs @@ -52,10 +52,19 @@ public EmbeddedFileProvider(Assembly assembly, string baseNamespace) _lastModified = DateTimeOffset.UtcNow; -#if NETSTANDARD1_5 - if (_assembly.Location != null) +#if NETSTANDARD1_5 || NET451 + if (!string.IsNullOrEmpty(_assembly.Location)) { - _lastModified = File.GetLastWriteTimeUtc(_assembly.Location); + try + { + _lastModified = File.GetLastWriteTimeUtc(_assembly.Location); + } + catch (PathTooLongException) + { + } + catch (UnauthorizedAccessException) + { + } } #endif } diff --git a/src/Microsoft.Extensions.FileProviders.Embedded/project.json b/src/Microsoft.Extensions.FileProviders.Embedded/project.json index 565d9e75..aee655ff 100644 --- a/src/Microsoft.Extensions.FileProviders.Embedded/project.json +++ b/src/Microsoft.Extensions.FileProviders.Embedded/project.json @@ -28,12 +28,14 @@ "System.Runtime.Extensions": "4.1.0-*" }, "frameworks": { + // need to keep netstandard1.0 until ASP.NET Core 2.0 because it is a breaking change if we remove it "netstandard1.0": { }, "netstandard1.5": { "dependencies": { "System.IO.FileSystem": "4.0.1-*", "System.Reflection": "4.1.0-*" } - } + }, + "net451": { } } } \ No newline at end of file