.exe文件未在新文件夹中运行。

编程入门 行业动态 更新时间:2024-10-23 04:38:25
本文介绍了.exe文件未在新文件夹中运行。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在Win 8.1系统上使用VB 2012开发一些软件。生成的.exe文件在开发(/ bin)文件夹中运行正常,但在移动到另一个测试文件夹(带有所需的dll)时不会运行。 任何人都可以提出了这种情况发生的原因? PS我最初怀疑我正在运行的AVG反病毒,但是它的去激活并没有区别。 TIA。

I am developing some software with VB 2012 on a Win 8.1 system. The resultant .exe file runs OK in the developing (/bin) folder but will not run when moved to another test folder (with its required dlls). Can anyone suggest a reason why this is happening? P.S. I initially suspected the AVG anti-virus I am running, but de-activating it made no difference. TIA.

推荐答案

实际上你的可执行文件是针对项目文件夹中的一些其他资源(文件夹名称在此上下文中也很重要;请参阅解决方案1 ​​由 OriginalGriff ,因为运行应用程序需要很多东西,无论它是否只是在控制台中说 Hello world )。首先,我建议您尝试将项目构建为Release,而不是Debug。 存在差异 [ ^ ]。 其次,你应该总是使用Project - >发布(右键单击项目,选择发布)以获取可移植项目包。 Visual Studio只是通过创建文件夹和管理文件来帮助您开发和调试应用程序。您应该(在发布项目时)始终尝试构建项目,同时将构建类型设置为Release并获取已发布的项目; Visual Studio将在GUI中指导您如何做到这一点! Visual Studio会要求您选择一些依赖项,添加一些其他检查,并为您的项目生成安装程序。然后,您可以共享该包,它将允许用户安装该应用程序。你不能简单地将它从一个位置复制/粘贴到另一个位置(除非它是独立的)。 在版本构建类型中,Visual Studio省略了要在可执行文件中使用的调试器程序集。在调试模式下,Visual Studio会尝试添加它们,并处理可能引发的断点和其他异常。您还可以注意到两个可执行文件的大小差异! Actually your executable is targeting some other resources found in the project folder (folder names also matter in this context; see Solution 1 by OriginalGriff for that because many things are required to run an application no matter if it just says Hello world in your Console). First of all, I would suggest that you try to build the project as Release, not Debug. There is a difference[^]. Secondly, you should always use Project --> Publish (Right click project, select Publish) to get the portable project package. Visual Studio just helps you in developing and debugging the application by creating a folder and managing your files there. You should (while releasing the project) always try to build the project while setting build type to Release and get the published project; Visual Studio would guide you in a GUI how-to do that! Visual Studio would ask you to select some dependencies, add some other check ups, and generate an Installer for your project. You can then share that package, it would allow user to install the application. You cannot simply copy/paste it from one location to another (unless it is stand-alone). In release build type, Visual Studio omits debugger assemblies to be used in the executable. Where as in debug mode, Visual Studio tries to add them, and to handle breakpoints and other exceptions that might be thrown. You can also notice the difference in size of both executable files!

我们不能说,不是来自那个有限的描述,也不知道你的代码是什么 - 甚至不知道! 但是......如果它在同一台机器上开始查看权限:你移动它的文件夹很可能没有所需的写权限。当人们将数据文件保存在应用程序文件夹中并且它适用于开发人员时,这种问题很常见,但是在生产中失败,因为Program Files文件夹故意限制了写访问权。 如果它在不同的机器上,然后上面仍然是相关的,但它可以是从数据库连接字符串,通过没有安装正确的.NET框架,到使用不存在的固定文件夹。开始添加try ... catch块以至少检测错误发生的位置,并报告错误详细信息,以便开始缩小范围。 对不起 - 但是腿部工作完全取决于你:我们可以在没有更多信息的情况下为你解决这个问题! We can't say, not from that limited a description, and no idea what your code is like - or even doing! But...if it's on the same machine start by looking at permissions: it's likely that the folder you have moved it to doesn't have the required write permissions. It's common for this kind of problem to occur when people keep datafiles in the application folder and it works fine for dev, but fails in production because the "Program Files" folder deliberately has restricted write access. If it's on a different machine, then the above is still relevant, but it could be anything from a DB connection string, through not having the right .NET framework installed, to using a fixed folder which doesn't exist. Start adding try...catch blocks to at least detect where the error is occurring, and report the error details so you can start narrowing it down. Sorry - but the leg work is all down to you: we can;t solve this for you without a lot more information!

非常感谢你们都指出了我的方向。 Many thanks you have both pointed me in good directions.

更多推荐

.exe文件未在新文件夹中运行。

本文发布于:2023-10-30 19:25:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1543776.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:新文件   文件   夹中   exe

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!