C#调试文件夹复制到另一个位置时无法运行exe [英] C# Debug folder when copied to another location does not run the exe

查看:554
本文介绍了C#调试文件夹复制到另一个位置时无法运行exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Debug(或Release)文件夹复制到另一个位置时,该文件夹无法运行exe.它不会发出任何错误,而只是将系统挂起一两秒钟,然后立即恢复正常,就好像什么都没运行一样.

Debug (or Release) folder of my Desktop application when copied to another location does not run the exe. It issues no errors, but simply hangs the system for a second or two, but returns to normal straight away, as if nothing had been run.

Visual Studio 2015是否也在Debug的较高层次结构中创建依赖项?我使用Wix创建的安装程序未运行预期的exe,我认为这是Wix的问题.但是后来我通过将完整的Debug文件夹复制到一个临时子文件夹中进行了测试,该应用程序甚至从那里都没有运行.仅当它在Debug文件夹以外的其他地方存在依赖项时,它才会发生(因为可以从C:驱动器的绝对路径访问系统资源(dll),因此它们将始终可用.

Does Visual Studio 2015 create dependencies in upper hierarchy of Debug as well? My installer created using Wix was not running the intended exe and i thought it was Wix's problem. But then i tested it by copying the full Debug folder in a temporary subfolder and the app was not running even from there. It can only happen when it has dependencies present in places other than the Debug folder (because system resources (dlls) are accessed from absolute path of C: drive, so they would always be available.

推荐答案

清单文件或其他一些设置文件中可能有问题吗?指向您源层次结构中的文件夹的某些相对路径?可能只是缺少的图像文件或某种设置文件?否则可能会完全不同.

Could there be something wrong in your manifest file or some other settings file? Some relative path pointing to a folder in your source hierarchy? Maybe it is just an image file or some sort of settings file that is missing? Or it might be something completely different.

AI在您的另一个问题中写道,一种难以调试的依赖场景的方法是硬着头皮运行一个完整的 procmon.exe 会话(是与实时sysinternals工具共享直接热链接 ,只需点击一下即可立即开始下载-只是您知道).

A I wrote in your other question, one approach for hard-to-debug dependency scenarios is to just bite the bullet and run a thorough procmon.exe session (that is a direct hotlink to the live sysinternals tool share, clicking it will start the download instantly - just so you are aware).

在以下问题中,您可以快速了解如何使用此工具:

You can see a quick description of how to use this tool in this question: Registering a CPP dll into COM after installation using Wix Msi installer. The key is to set an include filter which will show only events you need to see - basically for your own application.exe should suffice I believe.

许多人都发现了这种procmon-stuff的过大杀伤力,并且不想处理它-但请相信我,它几乎总是揭示出一些意想不到的东西(但是并不总是有用).

像以前一样,此答案也可能值得一看(一般而言取决于依赖性): https://github.com/lucasg/Dependencies/releases .

As before this answer may also be worth a quick skim (on dependencies in general): After creating MSI Installer for WPF app in Visual Studio 2017, EXE does nothing. I would at least try the Dependencies.exe tool - even if it is a bit "beta-ish". You can download from here: https://github.com/lucasg/Dependencies/releases.

然后一定要仔细检查Visual Studio中的模块视图,我在链接的答案中对此进行了描述(Debug => Start Debugging,然后转到Debug => Windows => Modules).它应该显示加载的内容以交互方式运行您的项目.

And certainly double-check the modules view in Visual Studio which I describe in the linked answer (Debug => Start Debugging, then go Debug => Windows => Modules). It should show whatever was loaded to run your project interactively.

这篇关于C#调试文件夹复制到另一个位置时无法运行exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆