使用LocBaml的WPF本地化:System.IO.IOException未处理

时间:2013-11-20 22:39:03

标签: wpf locbaml

我正在使用LocBaml本地化WPF应用程序。我已经成功创建了附属程序集并将它们放在适当的文件夹中。我从我的盒子里运行应用程序,效果很好!动态更改语言等问题是,我不能在任何其他机器上运行它,但我的。我可以让一个同事在他们的盒子上编译应用程序,我可以从我映射的机器上成功运行应用程序,但他不能。这完全是令人困惑的。我相信它必须是如此简单,我忽视它。

System.IO.IOException was unhandled
  HResult=-2146232800
  Message=Cannot locate resource 'maincontrol.baml'.
  Source=PresentationFramework
  StackTrace:
       at MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode mode, FileAccess access)
       at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at DCG.Designer.Library.MainControl.InitializeComponent() in D:\TFS\CardWizard Software Main\Trunk\ClientInterfaces\DCG.Designer.Library\obj\Debug\MainControl.g.vb:line 628
       at DCG.Designer.Library.MainControl..ctor() in D:\TFS\CardWizard Software Main\Trunk\ClientInterfaces\DCG.Designer.Library\MainControl.xaml.vb:line 42
       at DCG.Designer.MainWindow.libWindow_LanguageChanged(Object sender, CultureInfo Language) in D:\TFS\CardWizard Software Main\Trunk\ClientInterfaces\DCG.Designer\MainWindow.xaml.vb:line 240
       at DCG.Designer.Library.MainControl.Language_Click(Object sender, RoutedEventArgs e) in D:\TFS\CardWizard Software Main\Trunk\ClientInterfaces\DCG.Designer.Library\MainControl.xaml.vb:line 808
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run()
       at DCG.Designer.Application.Main() in D:\TFS\CardWizard Software Main\Trunk\ClientInterfaces\DCG.Designer\obj\Debug\Application.g.vb:line 65
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

1 个答案:

答案 0 :(得分:0)

当然,经过两天让自己疯狂之后,我最终只需要签署集会。我的应用程序是使用唯一键签名的,因此我的本地化程序集也需要签名。仍然没有回答这个问题,为什么它在我的机器上没有签名,但无论如何,它现在有效!

在这里得到答案:http://social.msdn.microsoft.com/Forums/vstudio/en-US/35d7be1b-a0bb-4388-b05f-70182f0e9018/locbaml-doesnt-work

我使用以下内容签署了我的新本地化程序集:

sn.exe -R sv-SE \ my.resources.dll my.snk

相关问题