diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/ContentFilePart.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/ContentFilePart.cs index 02838d46d4f..93148ec7489 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/ContentFilePart.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/ContentFilePart.cs @@ -60,7 +60,7 @@ protected override Stream GetStreamCore(FileMode mode, FileAccess access) // File name will be a path relative to the applications directory. // - We do not want to use SiteOfOriginContainer.SiteOfOrigin because // for deployed files the files are deployed with the application. - Uri codeBase = GetEntryAssemblyLocation(); + string location = GetEntryAssemblyLocation(); string assemblyName, assemblyVersion, assemblyKey; string filePath; @@ -73,8 +73,7 @@ protected override Stream GetStreamCore(FileMode mode, FileAccess access) BaseUriHelper.GetAssemblyNameAndPart(Uri, out filePath, out assemblyName, out assemblyVersion, out assemblyKey); // filePath should not have leading slash. GetAssemblyNameAndPart( ) can guarantee it. - Uri file = new Uri(codeBase, filePath); - _fullPath = file.LocalPath; + _fullPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(location), filePath); } stream = CriticalOpenFile(_fullPath); @@ -103,15 +102,13 @@ protected override string GetContentTypeCore() #region Private Methods - private Uri GetEntryAssemblyLocation() + private string GetEntryAssemblyLocation() { - Uri entryLocation = null; + string entryLocation = null; try { - #pragma warning disable // Type or member is obsolete - entryLocation = new Uri(Application.ResourceAssembly.CodeBase); - #pragma warning restore // Type or member is obsolete + entryLocation = Application.ResourceAssembly.Location; } catch (Exception ex) {