【问题标题】:Error when I run the new Installer file of an Application i created in C#运行在 C# 中创建的应用程序的新安装程序文件时出错
【发布时间】:2014-04-22 14:19:58
【问题描述】:

我创建了一个 C# 安装程序应用程序。当我尝试运行桌面应用程序时,它会引发异常,并且我无法在组合框中获得任何值(尽管剩余代码运行良好)。通过 Visual Studio 2010 运行的代码运行良好。这是我单击图标时遇到的各种异常的描述。任何人都可以就我为什么得到这个提供一些帮助吗?

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Globalization.CultureNotFoundException: Culture is not supported.
Parameter name: name
????? is an invalid culture identifier.
   at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo..ctor(String name)
   at SampleResourceBundle.Loginpage.fillAppLangueCombo()
   at SampleResourceBundle.Loginpage.Form1_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************

【问题讨论】:

  • 你已经在同一台机器上安装了你的应用程序,这台机器也运行 VS2010?您是否在代码中强制执行了任何特定的文化?
  • @HassanNisar 是的,我已经将应用程序安装在具有 VS2010 的同一台机器上。是的,我有用于 ResourceBundle 的 SpecificCulture.cs 文件来更改组合框中的语言。
  • 应用程序加载时您强制执行哪种文化?
  • @HassanNisar static void InitResourceBundle() { ResourceBundle resBundle = ResourceBundle.GetInstance(); resBundle.LocaleRoot = "SampleResourceBundle.locale"; //我的语言环境文件是 resBundle.AddResourceFile("Form1"); resBundle.AddResourceFile("Form2"); resBundle.AddResourceFile("Form3");字符串文化 = Properties.Settings.Default.LastCulture; resBundle.Locale = 文化; Application.CurrentCulture = new CultureInfo(culture); }
  • 我希望你能把上面的代码弄出来。我已经删除了Form2.resource文件。你认为这可能是异常的原因吗? @HassanNisar

标签: c# .net exception installation resourcebundle


【解决方案1】:

问题:您的操作系统不支持强制执行的 Language CultureInfo。

如何测试

  1. 转到用户设置中的 AppData 文件夹。
  2. 找到应用程序文件夹并找到User.config文件。
  3. 将 XML 中 Properties.Settings.Default.LastCulture 的值修改为任何常见的 语言,例如:“en-GB”。
  4. 测试可执行文件。

解决方案:为您的操作系统下载语言包。

可在此处找到适用于 Windows 7 的语言包: http://windows.microsoft.com/en-us/windows/language-packs#lptabs=win7

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-21
    • 2018-03-23
    • 2011-07-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多