`
v5qqbrowser
  • 浏览: 355822 次
文章分类
社区版块
存档分类
最新评论

C#:Distribution of the .NET Framework

 
阅读更多

FROM:http://support.microsoft.com/kb/324733/en-us

------------------------------------------------------------------------------------------------------------------------

This step-by-step article describes how to distribute the .NET Framework with your application.

When you deploy a Microsoft .NET-connected application, the destination computer must have the .NET Framework installed. If the .NET Framework is not installed, the application cannot run. A Microsoft Visual Studio .NET setup and deployment project does not automatically install the .NET Framework. However, there are ways to make sure that the .NET Framework is installed before your application is installed.

Distribution of the .NET Framework

When you deploy Visual Studio .NET applications, the .NET Framework must be installed on the destination computer. When you create a Windows Installer setup package by using Visual Studio .NET deployment tools, the installer includes a default start condition (MsiNetAssemblySupport). This start condition verifies that the .NET Framework is installed on the destination computer. If the .NET Framework is not found on the destination computer, the installation is stopped and you receive the following error message:

This setup requires the .NET Framework. Please install the .NET Framework and run this setup again

You cannot include the .NET Framework in a Windows Installer setup package that you create by using Microsoft Visual Studio .NET deployment tools. The .NET Framework must be installed separately. You can deploy the .NET Framework on the destination computer in the following two ways:

  • Instruct the user to manually install the .NET Framework executable before installing the Visual Studio .NET application.
  • Download the Setup.exe Bootstrap sample (available on the Microsoft Developer Network (MSDN) site). Use the Setup.exe to install the .NET Framework redistributable package (Dotnetfx.exe). After the .NET Framework is installed, this Setup.exe starts the Windows Installer package for your application.

Requirements to Install the .NET Framework

There are basic configuration requirements that must be met to install Dotnetfx.exe. You must have one of the following operating systems and Microsoft Internet Explorer 5.01 or later installed on your computer:

  • Microsoft Windows 98
  • Microsoft Windows 98 Second Edition
  • Microsoft Windows Millennium Edition (Windows Me)
  • Microsoft Windows NT 4.0 (Workstation or Server) with Service Pack 6a
  • Microsoft Windows 2000 (Professional, Server, or Advanced Server) with the latest Windows service pack and critical updates available from the Microsoft Security Web site
  • Microsoft Windows XP (Home or Professional)
  • Microsoft Windows Server 2003 family

Depending on your application requirements, install one (or both) of the following:

  • MDAC 2.6 or later for data access, available from the Universal Data Access Web site
  • Core WMI for Windows instrumentation, available from the Download Center

Install the .NET Framework Manually

  1. Obtain the .NET Framework redistributable package:
    • To download the .NET Framework redistributable package, visit the following Microsoft Web site:
      http://msdn2.microsoft.com/en-us/netframework/aa731542.aspx
      -or-
    • Install the redistributable file from the Windows Component Update CD-ROM or DVD-ROM. It is located in the Wcu\dotNetFramework folder.
  2. Run Dotnetfx.exe to install the .NET Framework.
  3. If the Visual Studio .NET application requires it, you may add a start condition to the Windows Installed package to verify that MDAC version 2.6 or later is installed.

For additional information about .NET Framework Redistributable location, click the following article number to view the article in the Microsoft Knowledge Base:

308488 INFO: Download and Install the .NET Framework

Use Setup.exe to Distribute the .NET Framework with Your Visual Studio .NET Application

You may want to package your application so that the .NET Framework redistributable package is installed first, and then starts the Windows Installer package (.msi file) for your Visual Studio .NET application. The Setup.exe bootstrapping application is a sample that is available on the MSDN site to demonstrate how to do this. Change the Settings file (Settings.ini) to specify the locations of the redistributable package and your application installer. For more information about how to include the .NET Framework with your package, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/netframework/aa731542.aspx

Prepare Your Deployment Project for Use with the Setup.exe Bootstrapping Application Sample

To use the Setup.exe bootstrapping application sample with an installer that you created by using Visual Studio .NET deployment tools, you must prepare the deployment project for this scenario to work correctly. By default, a deployment project includes a Windows Installer bootstrapping application. However, the .NET Framework redistributable also includes a Windows Installer bootstrapping application. You must remove the installer bootstrapping application from your project. To do this, follow these steps:

  1. In Solution Explorer, click the deployment project.
  2. On the Project menu, click Properties.
  3. In the Property Pages dialog box, set the Bootstrapper property to None.
  4. On the Build menu, click Build Solution.
  5. Copy the Windows Installer file (.msi) to the deployment location (for example, a folder on a CD-ROM or a network share).
  6. Copy the Setup.exe bootstrapping application sample and the Settings.ini file that you downloaded in the "Use Setup.exe to Distribute the .NET Framework with Your Visual Studio .NET Application" section to the deployment location, and then follow the steps in the "Customize the Settings.ini File" section

Customize the Settings.ini File

  1. Open the Settings.ini file in a text editor (such as Notepad).
  2. Locate the Msi=FxCopSourceSetup.msi entry, and then replace the default path with the path of your .msi file, as in the following examples:
    • When mySetup.msi is located on the local computer in the same folder as Setup.exe, the path is Msi=mySetup.msi.
    • When the mySetup.msi is located on a network share in a folder named myProjectFolder, the path is Msi=\\myNetworkShare\myProjectFolder\mySetup.msi.
    • When mySetup.msi is located in a folder named myInstallerFiles, on the same CD-ROM as Setup.exe, the path is Msi=myInstallerFiles/mySetup.msi.
  3. Locate the FxInstallerPath=c: entry. Replace the default path with the correct path of the .NET Framework redistributable package, Dotnetfx.exe, as in the following examples:
    • When Dotnetfx.exe is located on the local computer in a folder named myProjectFolder, the path is FxInstallerPath=c:\myProjectFolder\.
    • When Dotnetfx.exe is located on a network share in a folder named myProjectFolder, the path is FxInstallerPath=\\myNetworkShare\myProjectFolder\.
    • When Dotnetfx.exe is located in a folder named myExecutables, on the same CD-ROM as Setup.exe, the path is FxInstallerPath=myExecutables/.
  4. To verify what build number and language version of the .NET Framework is installed, specify the language in the Settings.ini file. By default, if you do not specify a language for the LanguageDirectory variable, Setup.exe verifies that the English version is installed.
  5. Save the Settings.ini file.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics