[英]How to invalidate MUICache?
通過右鍵單擊項目->應用程序->程序集信息->標題,我已經修改了C#應用程序名稱。
如果已經安裝了應用程序,則它不會更新名稱,因為它是從未刷新的MUICache中提取應用程序名稱。
我正在嘗試找出一種方法,使我可以通過編程使MUICache無效,以便它可以適當地更新應用程序名稱。
謝謝
您可以使用以下方法刪除包含應用程序可執行文件路徑的MuiCache
項中的值。
從MuiCache
刪除該值后,通過Windows 打開方式對話框瀏覽到您的應用程序,將使用可執行文件的標題將更新的可執行文件路徑重新添加到MuiCache
。
using Microsoft.Win32;
using System.Linq;
using System.Reflection;
const string MuiCacheKeyPath =
@"Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache";
static void DeleteExecutablePathFromMuiCache()
{
string exePath = Assembly.GetExecutingAssembly().Location; // (1)
using (RegistryKey muiCacheKey = Registry.CurrentUser
.OpenSubKey(MuiCacheKeyPath, writable: true))
{
if (muiCacheKey.GetValueNames().Contains(exePath))
{
muiCacheKey.DeleteValue(exePath);
}
}
}
另外,如果要直接以編程方式更新標題,而不是DeleteValue(exePath)
,請調用:
muiCacheKey.SetValue(exePath, yourNewTitle);
(1)從這個答案到問題。 如何在.NET控制台應用程序中獲取應用程序的路徑? 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.