[英]Failure to launch: App built in VS2013 can't run outside of Debug folder
I am using VS2013 Pro on Win 7 and have an application that compiles and runs fine in the bin/x86/Debug folder (both with and without the debugger), BUT crashes instantly without a message, either onscreen or in the logs, if copied to any other folder. 我在Win 7上使用VS2013 Pro,并且在bin / x86 / Debug文件夹(带有和不带有调试器)中都有可编译并运行良好的应用程序,但是如果复制,BUT会立即崩溃,而不会在屏幕上或日志中显示任何消息到任何其他文件夹。
Put another way, if the full path to the exe changes structure after compile in any way, it stops working. 换句话说,如果以任何方式编译后exe的完整路径都改变了结构,它将停止工作。 The names of the folders in the path can change, but not the structure. 路径中的文件夹名称可以更改,但结构不能更改。
I know this sounds like some sort of relative path thing, and maybe it is, but I have been unsuccessful in discovering what it is looking for. 我知道这听起来像某种相对路径,也许是,但是我一直没有发现它想要的东西。
An odd clue to what is happening may be this; 这可能是一个奇怪的线索。 if I right-click the exe in a folder where it doesn't run, and choose 'Troubleshoot Compatibility', then 'Try recommended settings', and then 'Start the program...', it runs fine. 如果在不运行该文件的文件夹中右键单击该exe,然后依次选择“故障排除兼容性”,“尝试推荐设置”和“启动程序...”,则该文件可以正常运行。
The app itself is .NET Framework 4 Winforms that references a few System.* DLLs and a DLL produced by a C++ project in the same VS2013 solution (that compiles without error). 该应用程序本身是.NET Framework 4 Winforms,它引用了几个System。* DLL和一个C ++项目在同一VS2013解决方案中生成的DLL(可正确编译)。
So, what is going on here? 那么,这是怎么回事? I could use some ideas... 我可以使用一些想法...
Check the assemblies which are referenced by your application and if they are not the default .NET Assemblies like System , System.Data go to their properties (in property window) and select True for Copy Local option. 检查应用程序引用的程序集,如果它们不是默认的.NET程序集(如System , System.Data),请转到其属性(在属性窗口中),然后为“ 复制本地”选项选择“ 真 ”。
Make sure you have verified all third party/project assemblies which are referenced by your application as well as the assemblies which are referenced by your application's dependencies as per above check. 确保已验证应用程序所引用的所有第三方/项目程序集以及应用程序依赖项所引用的程序集(按照上述检查)。
One more important thing if your application is referencing an assembly which is also referred by one of it dependent assembly make sure they are same otherwise at the time of building one assembly will replace another and your application might crash due to System.BadImageFormatException or System.IOException . 更重要的一点是,如果您的应用程序引用了一个程序集,并且该程序集也依赖于其中一个依赖程序集,请确保它们相同,否则在构建一个程序集时将替换另一个程序集,并且您的应用程序可能由于System.BadImageFormatException或System而崩溃。 IOException 。 In this scenario application can crash without leaving any trace. 在这种情况下,应用程序可以崩溃而不会留下任何痕迹。
I hope it will help. 希望对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.