Share via


How to: Deploy a Web Application Project Using One-Click Publish Without Web Deploy

This topic explains how to deploy a Web application project by using one-click publish and one of the following publish methods: FTP, File System, or FPSE (Front Page Server Extensions). One-click publish enables you to automate some of the tasks that are required in order to deploy a Web application.

These publish methods only copy files. They do not propagate IIS settings or databases or perform other tasks that might be required in order to deploy a Web application. To automate other deployment tasks, you must use the Web Deploy publish method. For more information, see How to: Deploy a Web Application Project Using One-Click Publish and Web Deploy.

Note

Web deployment tools have been improved in Visual Studio 2012. You can install the improved tools in Visual Studio 2010 and Visual Web Developer 2010 Express by installing the Visual Studio Web Publish Update. For information about how to use the new tools, see the documentation for Visual Studio 2012. A good place to start is Web Application Project Deployment Overview for Visual Studio and ASP.NET.

Deploying a Web application using a Web Deployment package might involve the following additional task that is not covered in this procedure:

  • Specifying Web.config file transformations. Web.config files typically include settings that have to be different depending on which environment the application is running in. For example, the Web.config file on your development computer might enable debugging, but you typically do not want debugging enabled for an application that runs on a production server. You can create transform files that automate the process of changing Web.config settings during deployment. For more information, see How to: Transform Web.config When Deploying a Web Application Project.

For more information about Web application project deployment, see ASP.NET Deployment Content Map.

Specifying Files to Deploy

You use the Package/Publish Web tab of the project Properties page to configure settings that determine what should be included when the Web application is deployed. The default settings on this tab work for many typical scenarios. You can skip this procedure if the following conditions are true:

  • You want to deploy only the files that are required in order to run the site. For example, this is typically true if source code files are compiled into assemblies, and you want to copy only the assemblies to the destination server.

To specify files and settings to deploy

  1. In Solution Explorer, right-click the project name and then click Properties.

  2. Click the Package/Publish Web tab.

    The Package/Publish Web tab is displayed, as shown in the following illustration:

    Package/Publish dialog box

  3. In the Configuration drop-down list, select the build configuration that you want to configure deployment settings for.

    You can configure deployment for the Debug or Release build configurations, or fora custom build configuration that you have created by using the Configuration Manager dialog box. For example, you might want different settings for deploying to a test server and for deploying to a production server.

    The default value for the Configuration is Active, which means that the settings on this tab apply to the build configuration that is currently selected for the project. The currently selected build configuration is shown in the main toolbar and in the Configuration Manager dialog box. (To open Configuration Manager, select it from the Build menu.)

  4. Select one of the following options from the Items to deploy (applies to all deployment methods) drop-down list:

    • Only files needed to run this application. Files that are not required in order to run the site are not deployed to the destination server, such as code files that are compiled into assemblies.

    • All files in this project. All files included in the project are deployed to the destination server. Files that are in the project folder but are not included in the project are excluded.

    • All files in this project folder. All files in the project folder are deployed to the destination server, even if they are excluded from the project.

    For more information about how Visual Studio determines which files to deploy, see the question "Why don't all of the files in my project folder get deployed?" in ASP.NET Web Application Project Deployment FAQ.

  5. If you expect that you will never want to enable debugging on the destination server, select the Exclude generated debug symbols check box.

    Clearing this option causes .pdb files to be deployed to the destination server. These files are required for debugging. You typically do not want .pdb files on a production server, but you might want them on a test server.

  6. If you have files in the App_Data folder and you do not want them to be deployed to the destination server, select the Exclude files from the App_Data folder check box.

    A typical scenario is to use a SQL Server Express .mdf file in the App_Data folder during development, but to use a SQL Server database that is not file-based on the production server. In that case, you would select this option when you deploy to the production server because there is no use for the .mdf file on the production server.

Creating a Publish Profile

Before you can publish the Web application, you must create a publish profile that specifies how to publish. You can create multiple profiles that have different settings. Before you click the Publish button, you can select the profile that has the settings that you want to use. The publish profile settings apply to the active build configuration (for example, Debug or Release). The following procedure explains how to create a profile.

To create a publish profile

  1. In the Build menu, click Publish projectname.

    The Publish Web dialog box is displayed with Web Deploy as the default value for the Publish method drop-down list, as shown in the following illustration:

    Publish Profile dialog box

  2. In the Publish profile box, enter a name for the new profile.

  3. In the Publish method drop-down list, select FTP, File System, or FPSE. (If you select FTP, you can also use FTPS.)

    The bottom half of the Publish Web dialog box changes to show fields that are appropriate for the selected publish method. The following illustration shows the dialog box when FTP is selected.

    Publish Web dialog box with FTP selected

  4. In the Target Location box, enter a value that corresponds to the publish method that you selected:

    • For FTP, enter the URL of the destination FTP site (for example, ftp://contoso.com).

    • For File System, enter the destination folder address (for example, \\servername\folder).

    • For FPSE, enter the URL of the destination Web site (for example, https://contoso.com).

  5. If you selected the FTP publish method, perform the following steps:

    1. If you do not want passive mode, clear the Passive Mode check box. You typically require passive mode if the client computer is behind a firewall. For more information, see FTP-Deployed Web Site Projects.

    2. If login is not required, select the Anonymous Login check box. Otherwise, enter credentials in the User name and Password boxes.

    3. If you want the password to be saved so that you do not have to enter it every time you publish, select the Save password check box.

      The password is saved in encrypted form in an .xml file in your project folder.

  6. Click the Save button to save the profile.

Publishing the Web Application

One-click publish is designed to make iterative publishing easy. After you have configured settings and profiles, you can click a button, and Visual Studio deploys your project files to the destination server.

To publish the Web application

  • In the Publish Web dialog box, or in the Web One-Click Publish toolbar, click the Publish button.

    Note

    If you do not see the Web One-Click Publish toolbar, right-click the main menu and select Web One-Click Publish.

    The first time you click the Publish button, Visual Studio copies all the files that you specified in the Package/Publish Web tab. If you click the Publish button again, only changes are deployed. For example, suppose that your site has 100 Web pages and you add one Web page. When you click Publish again, only the new Web page is copied to the destination server.

See Also

Concepts

ASP.NET Deployment Content Map