简体   繁体   English

无法启动:VS2013中内置的应用程序无法在Debug文件夹之外运行

[英]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程序集(如SystemSystem.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.BadImageFormatExceptionSystem而崩溃。 IOException In this scenario application can crash without leaving any trace. 在这种情况下,应用程序可以崩溃而不会留下任何痕迹。

I hope it will help. 希望对您有所帮助。

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

相关问题 VS2013无法加载Windows 8 App的资源文件 - VS2013 Failure to load Resource file for Windows 8 App VS2013:在调试开始后运行可执行文件 - VS2013: Run an executable after debug has started vs_2013中的app_Code文件夹到dll - App_Code folder to dll in vs2013 被只能在VS2013上运行的LightSwitch项目占用时,使用C#7.0调试dll并从VS 2017构建 - Debug a dll using C# 7.0 and build from VS 2017 when consumed by a LightSwitch project that can only run on VS2013 在调试VS2013中没有启动操作 - no start action in debug VS2013 VS2013 Update 4,无法打开CSHTML文件 - VS2013 Update 4, can't open CSHTML files MonoDevelop无法导入VS2013 / 2015解决方案 - MonoDevelop can't import VS2013/2015 solutions 当我在我的asp.net mvc项目上以调试模式启动浏览器时,我可以告诉VS2013将其直接导航到网站的某个部分吗? - When I launch a browser in debug mode on my asp.net mvc project, can I tell VS2013 to navigate it directly to a certain part of the site? MSTest运行忽略测试(VS2013) - MSTest Run Ignored Tests (VS2013) VS2013似乎没有正确连接 - 调试器连接到但未配置为调试此未处理的异常 - VS2013 doesn't seem to attach correctly - a debugger is attached to but not configured to debug this unhandled exception
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM