Visual Basic program cannot find DLL in applications root folder - visual-studio

I have built a program using Visual studio 2013 in visual basic. I am using a set of DLLs to communicate to some external hardware. The computer I developed the software on is a Win7 64bit machine and I can compile and run the software with no hiccups on it. I also have another computer (Surface Pro 3 64bit) that I use to test my software on and that works as well. Basically I just locate the debug directory of the development computer and copy the EXE and support DLLs to the new computer and run the EXE. This all works with my surface pro 3 computer.
My company purchased some other surface pro 3 computers for our production department and I am trying to get the software running on those as well. I do the same thing. Grab the EXE and support DLLs from the debug directory of the development computer. Except on these computers when I run the software program it tells me it can't find the DLL for the program. The DLL is sitting right in the application's folder, yet it says it can't find it.
I have tried multiple things, like publishing the software and including the DLLs in the installation, then running the installation on the "problem" computers. This still doesn't work. Same issue, it can't find the DLL.

This could be a number of things:
Incorrect version of .NET - do the new computers have the target version of .NET installed on them?
A required DLL is not being found, you should enable assembly bind failure logging and try again - How to enable assembly bind failure logging (Fusion) in .NET

So it turns out that the DLL I was referencing requires the VC++ redistributable packages to be installed on the computer. I downloaded and installed these on all of the problem computers and now the software recognizes the DLL and run.

Related

“MSVCP100.dll is either not designed to run on Windows or it contains an error”

I built an application in C++ using Visual Studio 2010 Express. When I tried to run it on a certain computer today I got this error:
MyApplication.exe - Bad Image
C:\Path to My Application\MSVCP100.dll is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support.
The DLL mentioned is one of the Visual C++ Redistributable DLLs. My application’s installer used to launch Microsoft’s installer for those DLLs but I recently tweaked it just to install msvcp100.dll and msvcr100.dll alongside my application. The new way worked fine on a handful of other computers, though I can’t rule out the possibility that that was only because the DLLs had already been installed at system level on those other computers.
What is causing this sudden DLL mismatch?
That's STATUS_INVALID_IMAGE_FORMAT, the Machine property in the DLL header doesn't match the architecture of the application.
Do keep in mind that you are likely to have two copies of this DLL on your build machine, the x86 and the x64 version. Later versions of VS have a 3rd copy, the ARM version. So very high odds that you picked the wrong one. Usually you'd target x86, the one you tested your program with is stored in the c:\windows\syswow64 directory. The 64-bit version is in c:\windows\system32.
How these directories got these seemingly backward names is a story for another day :) Favor using the vc/redist subdirectory of the VS install directory as a source for the copy, it is less ambiguous.
This .dll file is related to the Microsoft Visual C++ 2010 Redistributable x64 Package.
Try removing the Microsoft Visual C++ 2010 Redistributable x64 Package by using the Add or Remove Programs item in Control Panel.
Then, install the latest version Visual C++ (file name= vcredist_x64.exe) from the site:
http://www.microsoft.com/en-us/download/details.aspx?id=26999
Hope that helped..
If all above suggested solutions not worked for you than download MSVCR100.dll 32 bit or 64 bit as per your system configuration.
Download DLL from below link
https://www.sts-tutorial.com/sites/downloadCenter.php?MSVCR100
Follow da steps
1.Download the dll from here
https://www.sts-tutorial.com/sites/downloadCenter.php?MSVCR100
2.open with winrar
3.Extract MSVCR100.dll to C:\Windows\System32
hope it will work c:

Windows Installer ability to place short-cut with different URIs

I have a windows form application which is being installed on client pc by using msi file trough active directories, application is a 32bit app which is being deployed to a 32 bit and 64 bit windows systems and as we know application folder names are different between 32 and 64 bit systems, Program Files and Program Files(x86), also during installation application shortcut is placed in startup folder so app will be started when PC us powered up.
Question: Is there a chance to build msi by Windows Installer provided by Visual Studion in such a way that it will check what operating system its being installed at and place the shortcut in to start up folder with correct URI, to Program Files\Applicaiton\ or Program Files(x86)\Applicaiton?
Thank you!
Windows Installer packages are platform aware (x86, x64 ). Windows Installer doesn't support 64bit packages running on 32bit platforms or 32bit packages writing to 64bit ProgramFiles.
You can compile your EXE as AnyCPU and even though it's installed as 32bit it'll execute as 64bit. Although the Visual Studio team has moved away from that and compile as x86 by default in recent versions of Visual Studio.
Upon initialization, the Windows Installer gathers information about the operating system and automatically sets properties that can be used in optional conditional statements used by the setup application, such as VersionNT64 and "System Folder Properties"
In cases where it is necessary for the setup to know this information, it is preferred practice to allow the Windows Installer service to determine folder locations rather than try to hard-code this information into the package.

Deploy mixed code Visual Studio application

I have a problem running my application on other machines.
I am developing with Visual Studio 2008 in a Win7 x64 machine.
The solution contains several C# projects (the main application is written in C#, all others are library projects) and two c++/CLI libraries. The C++ libraries are Win32 and all C# projects are set to x86 target processor. No third party libraries used. Framework used is v3.5.
The application builds and runs fine on my machine.
I copied the whole "bin\release" folder to a Win7 x86 machine and it ran fine, too.
But when I tried on a XP x86 system, it did not start. No error message, not even showing up shortly in the task manager. The XP system has all updates installed, all available .NET frameworks installed and all Visual Studio Runtimes installed.
I checked with DependencyWalker and the only missing dlls are "IEShim.dll" and "wer.dll" which are only for Vista or higher.
I tried another of my applications that's not using C++ libraries and they work fine. So I guess I am doing something wrong deploying the C++ dlls.
Registering the C++ dlls with "regsvr32" failed with a "DllEntryPoint" not found message. Registering with "regasm" was successful, but had no effect.
What is it that I am missing?
Well, seems like I was a bit hasty stating "no third party components".
Actually it was the SQL Server Compact who was missing its runtime.

GHC + wxHaskell on Windows

Have GHC 6.8.3 and wxHaskell-0.10.3 on a Windows XP computer. Installed both as binary distributions, not by building from sources. Built a sample with the following command:
ghc --make Paint.hs
It works on that same computer it was built on (with GHC and wxHaskell installed), but fails if transferred to another one (with neither of them installed). It throws an "Application error" box with "The application failed to initialize properly (0xc0150002). Click OK to terminate the program."
The only non-system dll it wanted was wxc-msw2.6.4-0.10.3.dll, which I copied to it's folder.
What might be the reason?
The error comes from dependencies that are mentioned in the manifests of DLL's (presumably the third-party ones with wxHaskell) that your system is expecting to find installed in places such as WinSxS and SoftwareDistribution in your Windows directory. I am guessing the wxHaskell installation puts the files there.
You may be able to find what files the program is looking for by looking in the event viewer on the failed machine. You may even be able to fix them by moving the files from a working machine, However, VC++ 2005 runtimes are the most likely, as suggested - the wxHaskell troubleshooter suggests you try the VC++ 2005 service pack 1 redistributables:
http://www.microsoft.com/downloads/details.aspx?FamilyID=200b2fd9-ae1a-4a14-984d-389c36f85647&DisplayLang=en
My guess is, you want to install the VC++ runtime redistributable files onto the target computer. The redistributable files for applications built with visual studio 2005 are available from here:
http://www.microsoft.com/downloads/details.aspx?familyid=32bc1bee-a3f9-4c13-9c99-220b62a191ee&displaylang=en
Datapoint: Works for me on an XP sp2 box.

Debug XP application on Vista computer

I am building an MFC application for both XP and Vista. I have Visual Studio 2008 installed on the XP machine but I need to debug the application on Vista. How can I do that? Do I really have to install Visual Studio on a Vista machine?
When using remote debugging I assume that all executable and library files must be in my Vista virtual machine. But I can seem to copy the MFC debug DLLs to the Vista VM, and as a result I keep getting side-by-side configuration errors.
I would prefer to remote debug the application without having to copy any files, how can I do that? And if I can't, how can I install the MFC DLLs without having to install Visual Studio on the Vista machine?
Note: I have Vista installed on a virtual machine using Virtual PC. I just don't know how to run the debug version of my application there.
You can install VirtualPC (or other virtualization software) and install Vista as virtual system, so you don't need two computers. For this part of the debugging, it probably better that you explicitly do not install visual studio to make sure there's not some hidden dependency in your program that visual studio provides. At this point you want to be testing the fully-deployed version of the app.
The biggest rule I've found so far for developing for vista is making sure that you never write anything to the same folder where the program is installed. Write to the Application Data folder instead. This was a rule for XP, too, but it's much more strictly enforced in vista.
If you have Visual Studio Pro or Team, you can give remote debugging a shot. There's just a tiny stub that gets installed on the remote computer.
If you want to run a debug build of your application, you will need to install the debug runtime files on the virtual PC as well.

Resources