.net - WPF 应用程序 : get 3rd party binaries from install on target machine

标签 .net wpf assemblies

我已经使用 Visual Studio 2010 SP1 定义了一个使用 Telerik 控件的 WPF 应用程序。 我已将 Debug 文件夹中的内容(.exe 文件和 .dll 二进制文件)复制到另一台机器上,效果很好。但是,我不希望将 Telerik 二进制文件与 exe 文件一起复制。我希望 exe 与目标机器上本地安装的 Telerik 一起工作。

到目前为止我尝试了什么:

  • 我在目标机器上安装了 Telerik,并将二进制文件的路径添加到系统环境路径变量中。然而,我还不能运行 .exe 文件。我怎样才能做到这一点?
  • 我安装了 gacutil.exe 并将二进制文件添加到 GAC。我可以测试: gacutil/l | findstr “Telerik” 并找到我添加的所有程序集。
  • 我尝试将这些程序集 (Telerik) 放在 C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0 中,同时尝试 x64 和 x86。
  • 我尝试将这些程序集 (Telerik) 放在 C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5 中,同时尝试 x64 和 x86。
  • 我还尝试将程序集放在这里:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0

以上均无效。唯一的方法是将 .dll 文件放在我不想要的同一目录中的 .exe 旁边。

编辑:事件日志错误:(应用程序事件日志 ID 1000 中的应用程序错误)

Faulting application name: WpfApplication.exe, version: 1.0.0.0, time stamp: 0x51f6aef5
Faulting module name: KERNELBASE.dll, version: 6.1.7601.17651, time stamp: 0x4e21213c
Exception code: 0xe0434352
Fault offset: 0x000000000000cacd
Faulting process id: 0x34c
Faulting application start time: 0x01ce8cba7febd62e
Faulting application path: C:\Users\administrator.MyPC\Desktop\Debug\WpfApplication.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: bdb99d28-f8ad-11e2-89c4-00155db4f007

编辑 2:事件日志错误 ID 1026

Application: WpfApplication.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Windows.Markup.XamlParseException
Stack:
   at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader, Boolean, System.Object, System.Xaml.Permissions.XamlAccessLevel, System.Uri)
   at System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream, System.Windows.Markup.ParserContext, System.Object, Boolean)
   at System.Windows.Application.LoadBamlStreamWithSyncInfo(System.IO.Stream, System.Windows.Markup.ParserContext)
   at System.Windows.Application.LoadComponent(System.Uri, Boolean)
   at System.Windows.Application.DoStartup()
   at System.Windows.Application.<.ctor>b__1(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Threading.ExecutionContext.runTryCode(System.Object)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at System.Windows.Application.Run()
   at SilverlightApp.App.Main()

谢谢你,

最佳答案

编辑 我添加的 GAC 程序集与引用程序集版本冲突!

关于.net - WPF 应用程序 : get 3rd party binaries from install on target machine,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17932203/

相关文章:

.net - CssClass 在 UpdatePanel 更新时重复

.net - 为什么 IStructuralEquatable 和 IStructuralComparable 不是通用的?

wpf - 将样式的 TargetType 属性设置为基类

Wpf 面板布局 - 一个子项,多个位置

c# - 如何在代码隐藏中设置 Validation.ErrorTemplate?

c# - 需要一个 C# 程序集来松散地引用一个强命名的程序集

c# - 如何从特定程序集引用命名空间?

c# - 如何使用不属于桌面的显示器 (Windows 7)

c# - SQL 批量存储过程调用 C#

c# - 我如何订阅在另一个程序集中引发的事件