From e0129a3c475ba7f89315724560eb2ecd5a1cdfb0 Mon Sep 17 00:00:00 2001 From: singhashish-wpf Date: Tue, 29 Aug 2023 16:44:23 +0530 Subject: [PATCH] gbchars --- .../Windows/GenerateTemporaryTargetAssembly.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs index 3cb7ac44c50..49af58efb91 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs @@ -122,8 +122,12 @@ private bool ExecuteLegacyGenerateTemporaryTargetAssembly() XmlDocument xmlProjectDoc = null; xmlProjectDoc = new XmlDocument( ); - xmlProjectDoc.Load(CurrentProject); - + //Bugfix for GB chars, exception thrown when using Load(CurrentProject), when project name has GB characters in it. + //Using a filestream instead of using string path to avoid the need to properly compose Uri (which is another way of fixing - but more complicated). + using(FileStream fs = File.OpenRead(CurrentProject)) + { + xmlProjectDoc.Load(fs); + } // // remove all the WinFX specific item lists // ApplicationDefinition, Page, MarkupResource and Resource @@ -247,8 +251,12 @@ private bool ExecuteGenerateTemporaryTargetAssemblyWithPackageReferenceSupport() XmlDocument xmlProjectDoc = null; xmlProjectDoc = new XmlDocument( ); - xmlProjectDoc.Load(CurrentProject); - + //Bugfix for GB chars, exception thrown when using Load(CurrentProject), when project name has GB characters in it. + //Using a filestream instead of using string path to avoid the need to properly compose Uri (which is another way of fixing - but more complicated). + using(FileStream fs = File.OpenRead(CurrentProject)) + { + xmlProjectDoc.Load(fs); + } // remove all the WinFX specific item lists // ApplicationDefinition, Page, MarkupResource and Resource RemoveItemsByName(xmlProjectDoc, APPDEFNAME);