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:
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:
Those three files should be copied to your CD_IMAGE folder and you should use the EXE file in the shellexecute= line, like this:
The whole autorun.inf file will look like this: Code:
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.
This summary is a step by step procedure to create a distribution MEDIA including the .Net Framework redistributable for your .Net Application.
- Create a folder named CD_Image anywhere on your hard drive.
- Create a folder named Microsoft under the CD_Image folder created on the previous step (CD_Image\Microsoft).
- Download the .Net Framework re-distributable file from Microsoft.
- Copy the .Net Framework re-distributable file just downloaded to the CD_Image\Microsoft folder.
- 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.
- Make sure your .Net Framework's launch condition's property InstallURL is referencing the folder-file Microsoft\DotNetFx.Exe
- Build your application Deployment Project, make sure you are building a Release version.
- Copy the three files (exe, ini and msi) under your deployment project's release folder to the CD_Image folder.
- Make sure all three files share the same name, like:
- Create using your favourtie editor the autorun.inf files under the CD_Image folder, the autorun.inf file should contains at least these lines:
- 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.
- Run your favourite MEDIA burner (Nero or something else)
- 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.
- You should test your application distribution MEDIA on any machine or Virtual PC.
- Congratulations, you successfully created a distribution MEDIA for your application.
AUTORUN A WEB PAGE-SITE AFTER INSERTING YOUR DISTRIBUTION MEDIA ON THE TARGET MACHINE:
You may take this section as an additional alternative when designing your distribution media, currently the autorun.inf does not allow you to start a Web Application easily when you insert your CD or DVD media, but there is a freeware program known as ShellRun.exe written by PHD Computers Consultants that will allow you to do just that, this freeware program should be shipped in your media, and it will handle any web page request on the target machine, if you are shipping a web page-site in your distribution media, you should be able to make your distribution media installation interface experience more user friendly to your customers, by driving them through out a web page.
You can find more information about ShellRun.exe at this web site PHD Computer Consultants Ltd (ShellRun.exe); We suggest you to visit their web site as it contains further information about the autorun.inf file required to create autorun media.
The ShellRun.Exe does not replaced the autorun.inf file at all, you reference this program within the autoron.inf
If you decide to distribute your application with an autorun media showing a Web Site/Page, you should develop it using plain HTML pages (unless your web page development skills are solid); All the pages and images shown by this web installation site/page should be included as part of your distribution media, this is a folder containing all the files required, you may named this folder with something like MyInstallationPage or whatever suit you better.
If you take this path to distribute your application, your autorun.inf file should be something like the one show below:
- shellrun.exe is the program downloard from the PHD Computer Consultants page.
- MyInstallationPage is a folder on your distribution media containing the installation page web files.
- index.html is your installation site's home page, this file is located on your distribution media under the MyInstallationPage folder.
- icon= is an autorun.inf token identifying the icon to be displayed when looking at your CD-DVD media using Windows Explorer.
- btw.ico is the icon file, located on your CD-DVD distribution media's root directory. You can use whatever icon suits better your needs.
You should create the folder MyInstallationPage, and include the files shellrun.exe, btw.ico (or whateve icon suits you better) and index.html under your CD_IMAGE folder described above.