Tutorial: How To Deploy Your CS Application To Another Windows Computer For Testing
Original page created and posted by: Arcanor 12:02, 19 March 2007 (CET)
I'm interested to take my compiled application and move it to another computer for testing purposes. What files do I need to package up with it? I'd prefer to keep this package absolutely as small as possible.
The correct way to deploy under windows is to create an MSI package, but that is beyond the scope of this tutorial. We will only be dealing with packaging up your application for internal testing purposes.
Part of the Solution...
This section's content was taken from http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=164465&SiteID=1
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:
2) Copy msvcr80.dll, msvcp80.dll, msvcm80.dll from \windows\winsxs\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd
\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:
4) Paste the following content into the above manifest file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!-- Copyright ? 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:
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)
Some Corrections to the Solution...
A couple of corrections for the above procedure, as we discovered upon implementation:
- The procedure says to copy the dll files from the directory "C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd". This is correct only if you have MSVC8 but have not yet installed SP1. This should not be the case, as everyone should be installing the service pack for MSVC. The new correct directory to copy the dll's from is "C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700", which corresponds to MSVC8, SP1. In the future, if SP2 comes out, it'll need to be the newer directory.
- In the manifest file that you create, you'll need to change the line where it says 'version="8.0.50608.0"' to be the appropriate version. In my case it was 'version="8.0.50727.762"'. Your correct version number can be determined by right-clicking one of the dll's, selecting Properties, then select the Version tab, and note the File version at the top of the panel.
- This procedure ONLY works when deploying Release versions of your app, meaning you need to build the Crystal Space and CEL projects using the Release configuration, then build your project using Release as well.
Once you've copied your CRT runtime folder into your app folder, you'll still need a few more things, notably:
- You also need to copy your vfs.cfg into your app folder. This file can be found in your $CRYSTAL directory.
- You also need to copy any dll's that you're using from the $CRYSTAL directory (after you've built the Release configuration of course) into your app folder. If in doubt, just copy all *.dll files.
- If you're using CEL, then you'll need to also copy the CEL dll's from your $CEL directory (after you've build the Release configuration of course) into your app folder.
- You also need to copy any data files needed by your project, or by CS and CEL. To be safe you can copy the entire $CRYSTAL/data folder and drop it into your app directory. If desired, you can also copy your $CEL/data folder on top of it.
Your app folder will probably be over 100mb in size now, maybe even over 200mb. It can be copied to another computer running Windows XP and it should "just run". Note that this procedure only works on Windows. It should work on Windows XP, and theoretically under Vista as well. I've not tested this procedure under Vista, but if someone else does then please drop me a note to tell me your results so I can update this tutorial. If for some reason you're deploying to an older windows version like Windows 2000, I believe the only change is that the 4 files in the Microsoft.VC80.CRT directory need to be copied directly into your app folder instead of into the subfolder. Again, I have not personally tested this, but it's said to work that way.
If you want to deploy a Debug version of your app for some reason (internal testing on another computer perhaps), everything above should work, with the following exceptions:
- When creating your manifest file, change line 7 to say 'name="Microsoft.VC80.DebugCRT"'.
- When creating your manifest file, also change each filename in lines 12-14 to use the debug versions of each library. i.e. - instead of file name = "msvcr80.dll", you'll need to use "msvcr80d.dll" (add the 'd' at the end of the dll name).
- When creating your manifest file, change line 8 to use the appropriate version (see above for how to get the version number). In my case it was 'version="8.0.50727.762"'.
- Use the appropriate folder to copy the debug dll's from. This should be "C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_5490cd9f" for SP1.
- When creating the folder to put the libraries into, name it "Microsoft.VC80.DebugCRT".
Here are some related links for background information:
You're using VC8? You need to properly install the runtime: