Skip to content

Commit 9ff4235

Browse files
committed
Update Resources.cs
Fix Error System.ApplicationException:“An error occurred while publishing WPFDevelopersExt
1 parent 18216cc commit 9ff4235

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/WPFDevelopers.Shared/Resources.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,20 +133,23 @@ private void OnUserPreferenceChanged(object sender, UserPreferenceChangedEventAr
133133

134134
void PublishWPFDevelopersExt()
135135
{
136-
try
136+
lock (typeof(Resources))
137137
{
138-
string exePath = Helper.GetTempPathVersionExt;
139-
if (File.Exists(exePath))
138+
try
139+
{
140+
string exePath = Helper.GetTempPathVersionExt;
141+
if (File.Exists(exePath))
142+
{
143+
KillExistingProcess("WPFDevelopersExt");
144+
File.Delete(exePath);
145+
}
146+
if (!File.Exists(exePath))
147+
ExportResource(exePath, "GZ.WPFDevelopersExt.exe.gz");
148+
}
149+
catch (Exception ex)
140150
{
141-
KillExistingProcess("WPFDevelopersExt");
142-
File.Delete(exePath);
151+
throw new ApplicationException($"An error occurred while publishing WPFDevelopersExt {ex.Message}");
143152
}
144-
if (!File.Exists(exePath))
145-
ExportResource(exePath, "GZ.WPFDevelopersExt.exe.gz");
146-
}
147-
catch (Exception ex)
148-
{
149-
throw new ApplicationException($"An error occurred while publishing WPFDevelopersExt {ex.Message}");
150153
}
151154
}
152155

0 commit comments

Comments
 (0)