简体   繁体   English

为什么我的Release只在我的机器上工作?

[英]Why my Release only works on my machine?

I am on Windows 64bit working with Visual Studio 2015. I have this WPF project with its C++ backend and it uses several additional packages such as OpenCV, EmguCV and DevExpress. 我在使用Visual Studio 2015的Windows 64位上。我有一个带有C ++后端的WPF项目,它使用其他几个软件包,例如OpenCV,EmguCV和DevExpress。

Now if I run as Release , it compiles fine. 现在,如果我以Release身份运行,则可以正常编译。 Also if I go to the current directory via explorer and navigate to bin -> Release then execute the .exe file, it also runs fine. 另外,如果我通过资源管理器转到当前目录并导航至bin -> Release然后执行.exe文件,它也可以正常运行。

Problem: The project does not work on any other machine: If I copy the whole Release folder and paste it onto another machine, and try to execute, it pops a " Could not load file or assembly " error. 问题:项目无法在其他任何计算机上运行:如果我复制整个Release文件夹并将其粘贴到另一台计算机上,然后尝试执行,则会弹出“ 无法加载文件或程序集 ”错误。 See Error Here and the full error below. 请参阅此处的错误和下面的完整错误。

Insights: Those target machines used to be able to execute a Release just fine and the same way (Copy/Paste or Installer). 见解:那些过去能够正常且完全相同地执行发行版的目标计算机(复制/粘贴或安装程序)。 The project targets .Net framework 4.5 and needs the 2013 + 2015 redistributable files. 该项目的目标是.Net framework 4.5并且需要2013 + 2015可再发行文件。 Everything is installed on the target machine. 一切都已安装在目标计算机上。 Also the Dlls that the error is mad about, exist physically in the Release folder. 该错误所困扰的Dll实际上也存在于Release文件夹中。 And when I build an installer (using Inno Setup ) I see all the needed and existing Dlls being included (OpenCv stuff and DevExpress). 当我构建安装程序(使用Inno Setup )时,我看到其中包含了所有必需的和现有的Dll(OpenCv素材和DevExpress)。

There are like 10 OpenCv Dlls that are not shown within " Solution Explorer -> References " but physically exist in the Release Folder (we pasted them their). 大约有10个OpenCv Dll没有显示在“ 解决方案资源管理器->引用 ”中,但实际上存在于“发布文件夹”中(我们将它们粘贴了)。 Now, if I remove these files from MY Release Folder, I get the exact same error. 现在,如果我从“我的释放文件夹”中删除这些文件,则会得到完全相同的错误。 On the other hand, if I paste them in THEIR Release Folder, the error persists. 另一方面,如果我将它们粘贴到“发行文件夹”中,该错误仍然存​​在。

The " Solution Explorer -> References -> Properties -> Local Copy " of all the files are set to true. 所有文件的“ 解决方案资源管理器->引用->属性->本地副本 ”设置为true。 I currently build as x86, because if I build as x64 I get this error: 我目前以x86进行构建,因为如果以x64进行构建,则会出现此错误:

Error NuGet Error: Unable to find version '2.4.8' of package 'OpenCV.overlay-x64_v120_Release'. 错误NuGet错误:找不到软件包“ OpenCV.overlay-x64_v120_Release”的版本“ 2.4.8”。 C:\\Users\\bla\\Desktop\\bla\\packages\\OpenCV.2.4.8\\build\\native\\OpenCV.targets C:\\ Users \\ bla \\ Desktop \\ bla \\ packages \\ OpenCV.2.4.8 \\ build \\ native \\ OpenCV.targets

What could be the issue? 可能是什么问题?

Complete Error: 完成错误:

Fatal @ 9/9/2016 9:18:19 AM - CurrentDomainOnUnhandledException v2.0.1.0 - Exception Info: System.Windows.Markup.XamlParseException: The invocation of the constructor on type 'bla.MainWindow' that matches the specified binding constraints threw an exception. 致命@ 2016年9月9日9:18:19-CurrentDomainOnUnhandledException v2.0.1.0-异常信息:System.Windows.Markup.XamlParseException:对类型为bla.MainWindow的构造函数的调用符合指定的绑定约束引发了异常。 ---> System.IO.FileNotFoundException: Could not load file or assembly 'bla.bla.bla.dll' or one of its dependencies. ---> System.IO.FileNotFoundException:无法加载文件或程序集bla.bla.bla.dll或其依赖项之一。 The specified module could not be found. 指定的模块无法找到。

at bla.MainWindow..ctor() 在bla.MainWindow..ctor()

--- End of inner exception stack trace --- ---内部异常堆栈跟踪的结尾---

at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri) 在System.Windows.Markup.WpfXamlLoader.Load中(XamlReader xamlReader,IXamlObjectWriterFactory writerFactory,布尔skipJournaledProperties,对象rootObject,XamlObjectWriterSettings设置,Uri baseUri)

at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri) 在System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader,布尔skipJournaledProperties,对象rootObject,XamlAccessLevel访问级别,Uri baseUri)处

at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream) 在System.Windows.Markup.XamlReader.LoadBaml处(流流,ParserContext parserContext,对象父级,布尔型closeStream)

at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc) 在System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream,ParserContext pc)

at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties) 在System.Windows.Application.LoadComponent(Uri resourceLocator,布尔bSkipJournaledProperties)

at System.Windows.Application.DoStartup() 在System.Windows.Application.DoStartup()

at System.Windows.Application.<.ctor>b__1_0(Object unused) 在System.Windows.Application。<。ctor> b__1_0(未使用对象)

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 在System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调,对象args,Int32 numArgs)

at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 在System.Windows.Threading.ExceptionWrapper.TryCatchWhen(对象源,委托回调,对象args,Int32 numArgs,委托catchHandler)

at System.Windows.Threading.DispatcherOperation.InvokeImpl() 在System.Windows.Threading.DispatcherOperation.InvokeImpl()

at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) 在System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(对象状态)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在System.Threading.ExecutionContext.RunInternal(ExecutionContext executeContext,ContextCallback回调,对象状态,布尔类型saveSyncCtx)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在System.Threading.ExecutionContext.Run(ExecutionContext执行上下文,ContextCallback回调,对象状态,布尔类型saveSyncCtx)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 在System.Threading.ExecutionContext.Run(ExecutionContext执行上下文,ContextCallback回调,对象状态)

at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) 在MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executeContext,ContextCallback回调,对象状态)

at System.Windows.Threading.DispatcherOperation.Invoke() 在System.Windows.Threading.DispatcherOperation.Invoke()

at System.Windows.Threading.Dispatcher.ProcessQueue() 在System.Windows.Threading.Dispatcher.ProcessQueue()

at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 在System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,布尔值和已处理)

at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 在MS.Win32.HwndWrapper.WndProc(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,布尔值和已处理)

at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 在MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)在System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调,对象args,Int32 numArgs)

at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 在System.Windows.Threading.ExceptionWrapper.TryCatchWhen(对象源,委托回调,对象args,Int32 numArgs,委托catchHandler)

at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) 在System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority优先级,TimeSpan超时,Delegate方法,对象args,Int32 numArgs)

at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 在MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam)

at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 在MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&msg)

at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) 在System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame框架)

at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 在System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame框架)

at System.Windows.Application.RunDispatcher(Object ignore) 在System.Windows.Application.RunDispatcher(对象忽略)

at System.Windows.Application.RunInternal(Window window) 在System.Windows.Application.RunInternal(窗口窗口)

at System.Windows.Application.Run(Window window) 在System.Windows.Application.Run(窗口窗口)

at bla.App.Main() 在bla.App.Main()

I found this link that may help you 我发现此链接可能对您有帮助

I want a solution for this : Please make sure that the file is accessible and that it is a valid assembly or COM component 我想要一个解决方案:请确保该文件可访问并且是有效的程序集或COM组件

Marked answer is: 标记的答案是:

the file is a native DLL which means you can't add it to a .NET project via Add Reference... you can use it via DllImport (see http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.aspx ) 该文件是本机DLL,这意味着您无法通过“添加引用”将其添加到.NET项目...可以通过DllImport使用它(请参见http://msdn.microsoft.com/zh-cn/library/system .runtime.interopservices.dllimportattribute.aspx

Right click references in the project then re-add the assemplies for the OpenCV again, then refresh and re-build the solution. 右键单击项目中的引用,然后再次为OpenCV重新添加组件,然后刷新并重新构建解决方案。 Also make sure that the project targets .Net framework 4.5 indeed, because sometimes the same errors appear if it targets .net client framework. 还应确保该项目确实以.Net Framework 4.5为目标,因为如果以.net客户框架为目标,有时会出现相同的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过客户端证书仅在我的机器上有效 - Passing a client certificate only works on my machine 为什么我的本地化仅对我的开发机器有效? - Why does my localization only work on my Development-Machine? 为什么 StartsWith 只在我的机器上返回错误的值? - Why does StartsWith return the wrong value only on my machine? 在控制器中注入我的设置可以在调试中使用,但不能在发行版中使用 - Injecting my settings in the controller works in debug, but not in release 为什么我的JavaScript函数只能在索引视图中使用? - Why my JavaScript functions only works in Index View? 为什么dataGridView只在我自己的计算机上工作? - Why does the dataGridView works only on my own computer? 发送邮件在服务器上有效,但在我的本地计算机上无效 - sending mail works on server but not on my local machine Eventhandler 的调用适用于其他机器,但不适用于我自己 - Invoke of Eventhandler works on other machine but not on my own LogonUser仅适用于我的域 - LogonUser works only for my domain 使用.mdf文件在其他计算机上发布我的应用程序的计划 - Release plan for my application on other machine by using .mdf file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM