Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.
Posted
Updated 4-Jul-15 21:47pm
v2

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!
 
Share this answer
 
v2
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!
 
Share this answer
 
Many thanks you have both pointed me in good directions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900