Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

How to perform unattended installs of the .NET Framework 2.0 redist and SDK

How to perform unattended installs of the .NET Framework 2.0 redist and SDK

Rate This
  • Comments 14

I received a question from a customer about how to perform a sequential unattended install of the .NET Framework 2.0 redistributable package and SDK.  I have written a couple of different posts in the past about the various command line parameters available for the .NET Framework 2.0 setup and some of the options for silent installs (for example, the posts here, here and here).  However, I realized that I've been sort of scattering this information across multiple blog posts and not providing simple, easy to understand examples of real world scenarios like this unattended install, so I'm going to try to start addressing that with this post.

Here are example command lines you can use to perform unattended installations for the .NET Framework 2.0 redistributable and SDK.

Silent installation

These command lines will run the .NET Framework 2.0 redist and SDK setups in fully silent mode.  The setup package will extract to a temporary location and installation will begin with no user interaction and no visible UI.  The user will see no visible indication that setup is running.

  1. dotnetfx.exe /q:a /c:"install.exe /q"
  2. setup.exe /q:a /c:"install.exe /q"

Standard unattended installation

These command lines will run the .NET Framework 2.0 redist and SDK setups in standard unattended mode.  The setup package will extract to a temporary location and installation will begin with no user interaction.  A progress dialog will appear on the screen during installation, and it will disappear when setup is complete.  Errors encountered during installation might pop up message boxes during installation if they occur.

  1. dotnetfx.exe /q:a /c:"install.exe /qb"
  2. setup.exe /q:a /c:"install.exe /qb"

Unattended installation with no cancel button available in the UI

These command lines will run the .NET Framework 2.0 redist and SDK setups in unattended mode with no cancel button.  The behavior of setup is the same as with the command lines above except the cancel button will be hidden on the progress page during installation.  This allows the user to know that a setup is in progress but prevent them from cancelling it (unless they kill the process in Task Manager).

  1. dotnetfx.exe /q:a /c:"install.exe /qb!"
  2. setup.exe /q:a /c:"install.exe /qb!"

Important notes to consider

  • The .NET Framework 2.0 has 3 versions - a 32-bit version, an Intel 64-bit version and an AMD64 version.  You will need to select the correct versions of the setup packages for the .NET Framework 2.0 redist and SDK to install on your system using these command lines
  • The .NET Framework 2.0 SDK requires that the redistributable is already installed.  Your unattended installation script will need to start the redistributable setup, wait for it to complete, and check the return code to determine whether or not it installed successfully before trying to run the SDK setup.  A return code of 0 means success with no reboot required, 3010 means success with a reboot required and any other return code means failure

 

  • Aaron, what is the most common way to have an installer (e.g., InstallShield) be able to install .NET Framework on to a computer along with an application? Do they typically just include dotnetfx.exe and call that using command-line switches as you described? Or are there installer merge modules available that can carry/install .NET Framework?

    Finally, how will the .NET Framework installer respond if the .NET Framework is already installed? Is it okay to try to install that "always," or should we write code that detects if it is installed first, and then invoke the installer only if necessary? What is the officially-supported method for detecting whether .NET 2.0 Framework is already installed and the correct version?
  • About the three different versions of the framework: Is it correctly understood that the Intel 64 version is for Itanium and that the AMD64 version also covers Intel Xeon with 64 bit extensions?
  • Hi Tzagotta and Rasmus - thank you for the good questions here. I created a new blog post with the answers to all of these questions. You can find the new post at http://blogs.msdn.com/astebner/archive/2006/01/15/513125.aspx.

    Please let me know if you have any additional questions or concerns.
  • Hi, the Standard unattended installation doesn't run. By the second step there is the error I should use the control panel to add / remove software.

    I use Windows XP Pro with SP2.

    Thanks for your help.

    Karsten Burger
  • Hi Karsten - You will need to make sure to run the commands with the fully qualified path to setup.exe because otherwise Windows will use a default folder order and try to launch the setup.exe in %windir%\system32.

    So you should use something like:

    c:\downloads\netfx20\sdk\setup.exe /q:a /c:"install.exe /qb"

  • Question
    You have written blog posts in the past describing the command line parameters that can be...
  • Sry, for my stupid questions.
    First step: dotnetfx.exe /q:a /c:"install.exe /qb" in the Directory C:\tmp which contains dotnetfx.exe

    Where ist now the setup.exe File?
  • Hi Karsten - The file dotnetfx.exe is the setup package for the .NET Framework redistributable.  The file setup.exe is the setup package for the .NET Framework SDK.  If you only want to install the redist, you won't have a file named setup.exe.  If you want the SDK, you will have to download its setup.exe separately from http://msdn.microsoft.com/netframework/downloads/updates

  • I have noticed that if try the unattended installation of dotnet 2 and if I dont have Windows Installer 3.0 or greater installed then the dotnet installation fails without error. To go around it, i made a bootstrapper that checks the windows installer version and installs it if needed and then calls the dotnetfx.exe which solves the problem. Is this a good workaround? or there is a simpler way?
  • Hi Fahad - If you perform an unattended install of the .NET Framework 2.0 and you do not have Windows Installer 3.0 installed, you will not see any visible error, but the return code from the installer should indicate failure.  In this case, I would suggest that you check for the presence of Windows Installer 3.0 or higher in the bootstrapper that you are using to launch .NET Framework setup.
  • This guide is intended to serve as a collection of links to articles, tools, tips and tricks that explain...
  • Hi Aaron

    Thanks for the post, is there any way we can suppress the reboot i am using this command line to suppress reboot dotnetfx.exe /q:a /c:"install /l /q /norestart" will it suppress the reboot?

  • Hi Anuj Mittal - The original version of the .NET Framework 2.0 does not require a /norestart switch.  It should automatically suppress reboots if any are required, and it will return exit code 3010 if installation is successful and a reboot is required.

    The .NET Framework 2.0 SP2 is a replacement for the original version of the .NET Framework 2.0, and it does require a /norestart switch.  You can download the .NET Framework 2.0 SP2 from www.microsoft.com/.../details.aspx, and you can run it with the following command line switches to perform a silent install with reboots suppressed:

    netfx20sp2_x86.exe /q /norestart

  • Very Good

Page 1 of 1 (14 items)
Leave a Comment
  • Please add 7 and 3 and type the answer here:
  • Post