Partager via


How to: Include prerequisites with a ClickOnce application

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Before you can distribute prerequisite software with a ClickOnce application, you must first download the installer packages for those prerequisites to your development computer. When you publish an application and choose Download prerequisites from the same location as my application, an error will occur if the installer packages aren't in the Packages folder.

Note

To add an installer package for the .NET Framework, see .NET Framework Deployment Guide for Developers.

To add an installer package by using Package.xml

  1. In File Explorer, open the Packages folder.

    By default, the path is %ProgramFiles(x86)%\Microsoft SDKs\ClickOnce Bootstrapper\Packages\.

Note

Starting with the Visual Studio 2019 Update 7 release bootstrapper packages will also be discovered under the path <VS Install Path>\MSBuild\Microsoft\VisualStudio\BootstrapperPackages.

  1. Open the folder for the prerequisite that you want to add, and then open the language folder for your installed version of Visual Studio (for example, en for English).

  2. In Notepad, open the Package.xml file.

  3. Locate the Name element that contains http://go.microsoft.com/fwlink, and copy the URL. Include the LinkID portion.

    Note

    If no Name element contains http://go.microsoft.com/fwlink, open the Product.xml file in the root folder for the prerequisite and locate the fwlink string.

    Important

    Some prerequisites have multiple installer packages (for example, for 32-bit or 64-bit systems). If multiple Name elements contain fwlink, you must repeat the remaining steps for each of them.

  4. Paste the URL into the address bar of your browser, and then, when you are prompted to run or save, choose Save.

    This step downloads the installer file to your computer.

  5. Copy the file to the root folder for the prerequisite.

    For example, for the .NET Framework 4.7.2 prerequisite, copy the file to the \Packages\DotNetFX472 folder.

    You can now distribute the installer package with your application.

See also