Install different version of merge module depending on processor architecture - visual-studio

I have a Windows .net solution that is deployed with a Visual Studio Deployment project.
My exe is a win32 app that runs fine on either a x86 or x64 windows.
However I included a merge module (*.msm) from a third party vendor which is available in a x86 and x64 version.
Now I could copy my whole deploy project and just change the msm, but I'm a lazy guy and the best thing would be to include both msm's in my installer and only install the module which fits the processor of the client machine.
Is there a way to do this with Visual Deployment projects?
Merge Modules seem to lack a Condition property like included exe / dll files have.

Related

Directing an application to find a DLL in a specific location

I'm working with a native C++/Win32/MFC application built using Visual Studio 2010 Pro on Windows 7 x64. The application is linked with some other DLLs using their .lib files.
I'd like to be able to run this application and have it find the DLLs in their respective directories without 1) having to put the DLLs in the application directory or 2) add the DLL directories to the PATH or 3) resort to dynamically loading the DLLs and having to lookup stuff at runtime.
Is this even possible? Is there some way to direct the OS loader to go find the DLLs in an arbitrary location I specify without having to add that to the PATH?
Basics:
In Visual Studio project settings, keep everything default specially in Release configuration.
Ensure that you give Release build to the client (Where VS wouldn't have been installed).
If client OS is 32-bit, you must give 32-bit. Otherwise you can give 64-bit (Release build in any case).
Now comes distribution and VC++ runtime library.
You must install appropriate Visual C++ Runtime on client's machine,
ensuring that:
The version should match (VC7, VC8,.. VC14 etc.)
The bit-ness should match. If your application is 32-bit, you need 32-bit
redistributable, and same for x64.
The service pack version must also
match!
It should be noted that all of them can co-exist! VC10 RTM, VC10 SP2, VC10 x64 RTM.. all can co-exist

“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:

Developing a driver for several Windows versions (xp, win7, vista)

We are developing a DLL, which calls generic WinUsb functions from WinDDK. This DLL needs to work in 32-bit and 64-bit versions of Windows, including xp, vista, win7, and possibly win8.
My question is, how can we manage the Visual Studio 2010 solution by targeting all these platforms? WinDDK libraries are different for each OS, so if I reference a library from the code:
#### #pragma comment (lib , "C:\\WinDDK\\7600.16385.1\\lib\\wlh\\i386\\winmm.lib" )
Or by referencing the library from the project options->includes section, this project only becomes correct for a particular target architecture. (In this example, Vista 32-bits, since I am including 'wlh').
Are we supposed to create a different project for each different OS target?
The WDK/DDK version does not constrain the OS version for which you build. You can pass the target OS as a build environment/compile parameter.
I think you should build DLL through DDK and use that in your VS project.
You can write pre-build event for your VS project to run a batch file which will build the DLL and put it in some well-known place for the project.
Also, you may have to create different project configurations for each platform you want to build for (at least different for 32-bit and 64-bit) and run appropriate build command for DLL.

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.

Deployment package for a 64-bit windows service in VS2010

I'm trying to create a deployment package for a windows service targeting x64.
I've made the setup project itself target x64 but I need to add custom actions to actually register/unregister the service.
However, when I add custom actions and try to run the installer, I get a BadFormat exception which indicates that the executable for my service is corrupted.
I suspect I'm running into the issue mentioned here but am unable to prove it.
This windows service is being developed as part of a far larger application using TFS for automated builds and deployment, continuous integration, etc - So manually tweaking bits of a binary file using tools which require the use of a GUI is a definite no-no.
So... What I need to know is; Is it possible to automatically build a deployment package for a 64-bit windows service in VS2010? If so how?
This will happen when either your service or one of the assemblies it uses was built with the Target Platform setting changed to x86. In which case you have to use the right version of Installutil.exe to register the service. There are two, in c:\windows\microsoft.net\framework and \framework64, respectively the 32-bit and the 64-bit version. Odds are good that you need the former. If you created a Setup project then you'd change the TargetPlatform property to x86.
Also check if you really need to have the target platform set, you only do if you have a dependency on unmanaged code like a COM server. The C# setting is in Project + Properties, Compile tab. The default for VS2010 is x86, just flip it to AnyCPU if you have no such dependency.

Resources