Hi!

I have installed VC++ 2005 Express and the Platform SDK according to the instructions on MSDN:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx
Compiling and running the following program on the dev computer works like a charm:
http://www.winprog.org/tutorial/simple_window.html

I then changed to release-mode, turned off debugging in the project properties and copied the .exe to another computer without VC++ 2005 Express on. I pretty much expected problems, so I wasn't very surprised when I got the error message saying that there was something wrong with the program configuration, like the one here:
http://forums.microsoft.com/msdn/showpost.aspx postid=23371&siteid=1

I have since then combed this forum and eventually found a number of different posts containing instructions how to deploy correctly, examples of these are:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=54317&SiteID=1
http://forums.microsoft.com/msdn/showpost.aspx postid=75707&siteid=1
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=156255&SiteID=1
I have also read about "Redistributing Visual C++ Files" on msdn:
http://msdn2.microsoft.com/en-us/library/ms235299.aspx

None(!) of these seems to do it for me, I suspect that this is mostly because the above examples does not deal with the Express-version, but I'm not sure.

For someone pretty new to the VS-environment it is a nightmare, so far, to find out how to go about to deploy the applications correctly.

Therefore, I would deeply appreciate it if someone could give a straight-up and complete guide on how to get this application (see the beginning of this post) to run on another computer (the one I have is running WinXP SP2, but if there's any difference in the approach when it's supposed to run on Win98-Win2K then please explain that as well). I know this is a lot to ask, but you will have my eternal thanks :).


Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

Ayman Shoukry

The proper way is to use vcredist_x86.exe.  More details are mentioned at http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=149470&SiteID=1 or to just link statically to the CRT using the /MT compiler switch.

For more info, please see:
http://msdn2.microsoft.com/en-us/library/ms235624.aspx
http://msdn2.microsoft.com/en-us/library/zebw5zk9.aspx


Thanks,
  Ayman Shoukry
  VC++ Team




Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

Ted.

But he's using Express which doesn't even come with a vcredist_x86.exe.  The only way with Express is using the merge modules that come with Express in the folder:

\program files\common files\merge Modules

plus ensuring that Windows Installer 3.x engine is available on the user's machine, and if it's not, installing that as well. 

The two methods that work with something higher than Express, are:

1) using vcredist_x86 in:

C:\program files\microsoft visual studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86

plus ensuring that Windows Installer 3.x engine is available on the user's machine, and if it's not, installing that as well. 

2) Copying these folders to your program folder (keeping the sub folder names):
\program files\microsoft visual studio 8\VC\redist\x86





Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

Ted.

OK, due to popular demand, and my frustration with seeing so many people using Express that simply want to run an app on another machine, without the hassle of learning about merge modules, Windows Installer, etc, etc, etc, here is a way to perform deployment option number 2 above (i.e. installing C Runtime library applocal) for Express.

1) On the machine you have Express installed, create the following folder and subfolders in your
\program files\microsoft visual studio 8\VC folder:

redist\x86\Microsoft.VC80.CRT

2) Copy msvcr80.dll, msvcp80.dll, msvcm80.dll from
\windows\winsxs\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd

into:

\program files\microsoft visual studio 8\VC\redist\x86\Microsoft.VC80.CRT

3) in the above Microsoft.VC80.CRT folder, create a new file named:

Microsoft.VC80.CRT.manifest

4) Paste the following content into the above manifest file:

< xml version="1.0" encoding="UTF-8" standalone="yes" >
<!-- Copyright c 1981-2001 Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <noInheritable/>
    <assemblyIdentity
        type="win32"
        name="Microsoft.VC80.CRT"
        version="8.0.50608.0"
        processorArchitecture="x86"
        publicKeyToken="1fc8b3b9a1e18e3b"
    />
    <file name="msvcr80.dll"/>
    <file name="msvcp80.dll"/>
    <file name="msvcm80.dll"/>
</assembly>

Now you have a new folder in your Visual C++ Express installation that can be re-used when ever you need it.

To deploy these files, simply copy the Microsoft.VC80.CRT folder you just created to your program folder.  That's it.  So for example, if your application executable resides in C:\Program Files\MyApp, you'll have a folder named:

C:\Program Files\MyApp\Microsoft.VC80.CRT

that contains the 4 files I mentioned (3 DLLs and one manifest file you created by hand)

No installation of anything else is necessary.  Just click on your EXE file, and your app will run.  No special installation engines are necessary, just make your setup program (installer) create that subfolder Microsoft.VC80.CRT along with what you normally install with your app)

Let me know if you need similar instructions for MFC and I'll create them. 





Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

Andreas_

Thank you VERY much Ted, an explanation like yours was exactly what I was looking for, and it worked perfectly :).




Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

hathawa

This procedure did not seem to work for me where I have a single DLL with an embedded manifest which is called from Java via JNI.  I put the Microsoft.VC80.CRT subdirectory in the same location as the dll.  Any ideas




Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

Ted.

Andreas, good to hear.  I wish they would've include those files in the default Express installations.

hathawa, I don't know how applocal installation is supposed to work in cases where you have no control over the main executable (i.e. you can only just put the manifest in the DLL and not the executable file)  I'll have to research that some more. 




Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

Saurabh.Garg

Dear Ted,

thanks for the information you provided for copying CRT files.
I want to do same for MFC based application also and I followed similar step for

Microsoft.VC80.MFC
Microsoft.Tools.VisualCPlusPlus.Runtime-Libraries

copying dlls in them and creating a manifest file which I copied and modified from winsxs\manifests but still my application is not working on a machine with no visual studio 2005. Did I miss something can you please provide step for doing same.

thanks,
Saurabh




Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

Ted.

For Microsoft.VC80.MFC after copying the manifest please open it up in notepad and change the version to 8.0.50608.0 

I just tried on my test machine and it worked.  Can you tell me what error you got   Try using dependency walker to see if it picks up the DLLs.

For the other one you mentioned I don't think you need it or require for your app if it's a 2005 app. It's for apps written in Visual C++ 6.0.    I woudn't recommend manifest for those DLLs if you require them.  Just copy them to system32 folder.

Ted.




Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

_Carlos_

Hi everybody;

With regards to the Windows Installer in this version of VC++ Express,... well, how

Whilst the one simple walkthrough that I found in the MSDN does, admittedly, state that menus and dialogues may differ dependant on settings, the 'Add New Project' dialog box that I see only contains the "Visual C++" 'node', as the walkthrough puts it, as opposed to the "Other Project Types" node mentioned there.

What have I not installed, or what am I doing wrong, or where do I need to look !

Any help would be much appreciated!

Thanks






Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express


Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

BobLane

I just install VC++ 2005 Express this week to make use of the new SerialPort class in MFC and am having a couple fo deployment problems. I have had my user install the framework redistributable for 2.0.

These problems are new to VC++ 2005 Express.

1. An attempt to execute the Debug version of the execuatbles give the "not properly configured" error. I have tried the dll and manifest copying trick recommended to no avail.

2. Execution of the Release version of the executables causes a failure in teh SerialPort ReadExisting call in which all of the data is received as question marks ( ). I saw this problem during development and the fix was to add an access to property BytesToRead before making the ReadExisting call. WHile that didn't make any sense to me at the time, it worked - but now it isn't





Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

Ted.

Bob Lane for debug versions just create a text file named:

Microsoft.VC80.DebugCRT.manifest

with the following contents:

< xml version="1.0" encoding="UTF-8" standalone="yes" >
<!-- Copyright c 1981-2001 Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <noInheritable/>
    <assemblyIdentity
        type="win32"
        name="Microsoft.VC80.DebugCRT"
        version="8.0.50608.0"
        processorArchitecture="x86"
        publicKeyToken="1fc8b3b9a1e18e3b"
    />
    <file name="msvcr80d.dll"/>
    <file name="msvcp80d.dll"/>
    <file name="msvcm80d.dll"/>
</assembly>

Then copy this file as well as the 3 files mentioned in the manifest to the folder where your program or DLL resides. 

Do the same for MFC: create a text file named Microsoft.VC80.DebugMFC.manifest and copy the following contents in there:

< xml version="1.0" encoding="UTF-8" standalone="yes" >
<!-- Copyright c 1981-2001 Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <noInheritable/>
    <assemblyIdentity
        type="win32"
        name="Microsoft.VC80.DebugMFC"
        version="8.0.50608.0"
        processorArchitecture="x86"
        publicKeyToken="1fc8b3b9a1e18e3b"
    />
    <file name="mfc80d.dll"/>
    <file name="mfc80ud.dll"/>
    <file name="mfcm80d.dll"/>
    <file name="mfcm80ud.dll"/>
</assembly>

Then copy this manifest plus the 4 DLLs mentioned to the same folder where your program or DLL resides.

It's that simple.

 





Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

BobLane

Ted, unfortunately, I am unable to locate the mfc*80d.dll files. Are you sure those are the right file names



Re: Visual C++ General Running a very simple Win32 app on a comp without VC++ 2005 Express

Ted.

Hi Bob, sorry, I didn't realize that it was VC++ Express. You can't even compile an MFC application using Express (it's not supported) so no debug nor release versions of MFC DLLs are included with Visual C++ Express. Under what situation are you finding that you require debug versions of MFC, if you can't even compile an app using MFC

As MFC doesn't come with Express, Is it possible you're trying to use the MFC version that came with the Platform SDK If so the only way around that would be to compile MFC as a static library (this is non-trivial)