Article Options
Premium Sponsor
Premium Sponsor

 »  Home  »  Deployment  »  Creating AutoRun Media to deploy your application.  »  Page 2
Creating AutoRun Media to deploy your application.
by Arnaldo Sandoval | Published  08/03/2007 | Deployment | Rating:
Page 2
THE AUTORUN.INF FILE

The key task is to create an AUTORUN MEDIA, because without it, your application's deployment project will not run automatically; this file is very simple, as you can see below:

Code:

[autorun]
shellexecute=Princeton_Install.exe


It has one section autorun enclosed between square brackets, and this section contains one single line: shellexecute followed by the name of an executable .exe file.

The sampe code shown match the image above, notice that the Princeton_Install.exe is also in the picture. We will explain more about what name to use later on.

This autorun.inf file executes the program on its shellexecute line, although, it will not start a web application to drive your user during the installation process, more about that later on as well.

THE shellexecute= COMMAND LINE

This is the line that idenfities the file to run when the user insert your CD MEDIA into the MEDIA Drive, the code snippets shows the name Princeton_Install.exe; You should use a different name of course.

Your Visual Studio's Setup and Deployment Project will generate three files at its Release folder, they will be an exe, msi and ini files, all three should have the same basename, if you want to name them MyApplication you will have:

Code:

MyApplication.Exe
MyApplication.MSI
MyApplication.Ini


Those three files should be copied to your CD_IMAGE folder and you should use the EXE file in the shellexecute= line, like this:

Code:

shellexecute=MyApplication.Exe


The whole autorun.inf file will look like this:

Code:

[autorun]
shellexecute=MyApplication.Exe
 
 

That will be it, the AutoRun.inf file now contains the name of the executable file to run once your application's distribution MEDIA is inserted into the MEDIA drive on the target machine by the user installing your application. You should keep in mind, we are talking about the CD_Image folder, you should build the MEDIA in order to test everything we had explained so far in this document, although, you should wait and keep reading, as there are more items you should add to the CD_Image folder.

You may want to look at the references below, some of the articles explains fancy thing you can do with autorun.inf files.

THE MICROSOFT FOLDER

Let's talk about the Microsoft folder appearing on the image above, your .Net application distribution media should include the corresponding .Net Framework redistributable installer, plus, depending on its design, additional Microsoft installers could be included in this folder, like the Microsoft Data Access Component (MDAC) and many more, like the IE6_Setup (It was a requirement to support Windows 98 SE for the application used to illustrate this article, some Windows 98 SE environment may not have IE6 installed, you need IE6 to install run .Net applications). 

 

Now, the autorun.inf file is completley unaware of the Microsoft folder, it is part of the distribution MEDIA because your application's installation package requires it; We already know that a Launch Condition directs the installation process to run the Net Framework distributable code, or a Custom Action module may run the MDAC or anything else located on the MEDIA.

You should copy the .Net Framework redistributable file under the CD_Image\Microsoft folder, if you created the launch condition as described by the FAQ document referenced above.

BURNING YOUR DISTRIBUTION MEDIA

Once you prepared the CD_IMAGE folder with all the files required by your .Net Application's installation, you are ready to burn its distribution MEDIA; (this document explains few things your distribution MEDIA may contain, there is not limit, it will be upto its requirements what to include on the MEDIA). The final step is to run your favourite MEDIA burner application (Nero or something else) copying everything under your CD_Image folder; WARNING Your MEDIA should include everything after the CD_Image folder, this folder itself should not be part of the MEDIA.

SUMMARY

This summary is a step by step procedure to create a distribution MEDIA including the .Net Framework redistributable for your .Net Application.

  1. Create a folder named CD_Image anywhere on your hard drive.
  2. Create a folder named Microsoft under the CD_Image folder created on the previous step (CD_Image\Microsoft).
  3. Download the .Net Framework re-distributable file from Microsoft.
  4. Copy the .Net Framework re-distributable file just downloaded to the CD_Image\Microsoft folder.
  5. Create the .Net Framework's launch condition on your Visual Studio's Setup and Deployment Project. You can't if you are using VS 2002.
  6. Make sure your .Net Framework's launch condition's property InstallURL is referencing the folder-file Microsoft\DotNetFx.Exe
  7. Build your application Deployment Project, make sure you are building a Release version.
  8. Copy the three files (exe, ini and msi) under your deployment project's release folder to the CD_Image folder.
  9. Make sure all three files share the same name, like:

    Code:

    MyApplication.Exe
    MyApplication.Ini
    MyApplication.Msi


  10. Create using your favourtie editor the autorun.inf files under the CD_Image folder, the autorun.inf file should contains at least these lines:

    Code:

    [autorun]
    shellexecute=MyApplication.Exe



  11. Copy any additional file(s) required by your application installation process, or your application documentation to the CD_Image, in other words, you can include anything you want to distribute with your application's distribution MEDIA.
  12. Run your favourite MEDIA burner (Nero or something else)
  13. Make sure the MEDIA your are burning contains all the information underneath the CD_Image folder. You should not create the folder CD_Image on the MEDIA.
  14. You should test your application distribution MEDIA on any machine or Virtual PC.
  15. Congratulations, you successfully created a distribution MEDIA for your application. 
     
Sponsored Links