Playing programs/games build in Visual Studio without installing the redists

Started by
5 comments, last by SiCrane 15 years, 3 months ago
Hello all, If i make the most simplist programs that exist and i want to run it on another computer, i have first to install the visual studio redist or something, is there a possibility to compile the needed libs with the program so that is not needed? Mvg Paul
Advertisement
You didn't mention which language you are using in Visual Studio. With a simple C++ program I don't think you need anything installed. For .NET applications you need .NET redistributable of course,.. but it shouldn't matter since nearly all application need them, so nearly all computer in the word already have them installed. I mean they are on Windows Update, so if your "other computer" don't have it, it probably have some security risk too and should update it's windows before even going on internet.
Quote:Original post by Dunge
With a simple C++ program I don't think you need anything installed.


You need the Visual C++ runtime. You can compile the runtime statically, but for all but the simplest of programs (i.e. anything much more complicated than "Hello World") I wouldn't recommend it. WiX isn't that hard to learn and creating a fully-functional installer is maybe 1/2 day's work with it (depending on how complicated your application is, but then if you're thinking about compiling the C++ runtime statically, it can't be that complicated).
The problem is, that as example a hello world program (with win32) i can't show to others because they don't have the visual studio runtime (vcredist or something) so if i want to show my hello world application i first need them to send them the link to install that... So that's my point, and i'm sure (because i saw it a time ago on internet) that you can include some files in your projects or something so you don't need them to install that vcredist first.

Mvg Paul
It depends on which version of Visual Studio you're using. With 2003, it's possible to just copy the runtime DLLs into a folder with your executable and unzip on someones computer and it'll run. With 2005 and 2008, it's a little more complicated. Basically, the 2005 and 2008 runtimes will not load properly unless the executable has an embedded manifest. With an embedded manifest you need to have the runtimes deployed either as a shared assembly or a private assembly. To install the runtimes as a shared assembly, just run the redistributable installer. To install the runtimes as a private assembly, you need copy certain folders from from the VC\redist subdirectory of your Visual Studio install into a subfolder of the executable. However, these directories don't exist if you have the express edition of either MSVC 2005 or 2008, and it'll only work with XP, Vista or 2003 Server unless you also add the directories to the PATH.
I've had the same problem and I didn't know about the manifest. I copied all the .dll files from VSINSTALLDIR\VC\redist and the x86 arch (to be on the safe side). My app was compiled as 32-bit, so I thought this would be enough. In my VirtaulBox'd windows XP, the redistributable package of my game ran fine, but when I sent it to friends, they said that a message "reinstall the program" appeared. After I didn't figure how to fix this, I compiled my game with MinGW, redistributed its runtime .dll and it all ran fine on their computers.
My version of VS is not the express, as my university is in the MSDN AA program.

So, could you please clarify on how to avoid installing VC redistributables and elaborate on the manifest thingy?

Thanks in advance.

PS
To be exact, I use VS TS 2008
You need to copy the actual folders from the redist directory, not just the DLLs. So if, for example, your application depends on the CRT and ATL, you would copy the folders Microsoft.VC90.ATL and Microsoft.VC90.ATL from VC\redist\x86 to the folder that your program is in. Details here (under the Deploying Visual C++ library DLLs as private assemblies header).

This topic is closed to new replies.

Advertisement