Publish Web or Database Project Using Visual Studio

Let's see how to publish a web or a database project using Visual Studio. There has been a significant change in how a website is published from version VS onward's. The publish utility has more features and at the same time it is easier for everyone to use. Now Visual Studio has also integrated the Azure publishing features. For that an Azure account is required. But here I am only listing the steps to publish a web or database locally or to a web server or to a third party hosting server.

Click on "Publish Web" from the "Build" menu; that will open the publish start up menu.

image1.gif

The Publish Web contains four steps to begin publishing. Those are Profile, Connection, Settings and Preview. Settings and Preview are optional here.

Profile

Here we can configure the publishing profile that contains the various web publish methods, Build Configuration, Publish URL or path and so on. This profile contains settings or configurations that are required before publishing. This configuration will be saved as a file for later use. We can create any number of configuration files. It is saved as a publish XML format file (.pubxml). The following is an example.

image2.gif

The preceding file shows the web publish method, Build Configuration, Publish URL or path and more. We can import an already existing configuration file or create a new profile by clicking on the dropdown and select "New" and enter a profile name. The importance of the profile is so there is no need to enter these settings every time. Just select the profile from the list to start the Publish directly.

image3.gif

Once the profile name has been created, the next step is to configure the other settings through the Connection wizard.

Connection

This wizard has most of the publishing settings, like various publish methods and the destination URL or path and so on. Five publish methods are available.

  • Using Web Deploy we can directly deploy or publish to a web server. We need to provide the server details along with the site root folder with user name and password. I will post another article on this later.

    image4.gif

  • Web Deploy Package will create a deploy package file in a zip or any other compression supporting format to a server location. We must provide a package location to save the file.

    image5.gif

  • Using FTP we can publish the files directly to our site root path. Here we need to provide a FTP URL as server information and site path. The rest is the same as for the Web Deploy method.

    image6.gif

  • FPSE or Front Page Server Extensions is another old way to publish the web site. But usage of the FPSE mechanism has decreased over the past few years because of other publish methods like FTP and so on. I never used FPSE :).

    image7.gif

  • File System is the one we use most of the time for publish. We need to just provide a target location path and that can be over local system path or a network path. Here I am using the file system to publish.

    image8.gif

Settings

This is an optional default entry where we can select the build configuration (Release/Debug) and other file publishing options.

image9.gif

More precompiled configurations are also available.

image10.gif

Preview

The final stage is where we can preview the publishing configuration based on the publishing method we selected.

image11.gif

Now click on Publish and verify the output window for publishing the update.

image12.gif

That's it; we have done the web publishing successfully.

Database Project publish

Now let's move to database publishing. Open your Database project and click on Publish Database from the Build menu or right-click on the database project and click Publish.

image13.gif

Click on Edit to enter the database connection properties with the required information and test the connection.

image14.gif

Click on "Advanced..." to get more advanced publishing settings and deployments options if required, like always re-create the database, back up databases before deployment and so on.

image15.gif

Next is an optional step to save these settings as a profile or we can create a profile or load an existing profile from an XML format (.publish.xml). We can even publish and register the database to be used in a Data-tier application. We can look into this method more in the future.

We can Publish or Generate a script for later deployment. Let's click on Generate Script and check the results in Data Tool Operations. Once the script is generated, view the preview and scripts by clicking on the links View Preview and/or View Script.

image16.gif

Also check the Output window.

image17.gif

That's it, we are done with web and database publishing. Please post your comments.

Thank you! 


Similar Articles