Tips About How to Deploy ASP.NET Web Application
Table of Contents
Introduction
Here are a few tips for deploying ASP.NET web applications.
For enterprise ASP.NET web application scenarios, please reference the following documents:
- Deploying Web Applications in Enterprise Scenarios
- Understanding the Project File
- Deployment made simple using Powershell
Copying Files During Build or Deploy
During the application build or deploy, if you have anything that needs to be included but is not checked in to the project, you can try the following approach.
The following is an example command that during the project build will copy files or folders to a specific location depending on whether you are building locally or deploying. If you use PowerShell to write your own deployment scripts, the following .csproj code will copy the files or folders, so you don't need to write that in PowerShell.
<!-- for local -->
<!-- for deploy to tfs-->
Example pubxml
The following does almost the same thing as the previous code, however it uses a project publish profile (.pubxml).
<?xml version="1.0" encoding="utf-8"?>
FileSystem
YourConfigurationName
Any CPU
True
False
C:\YourLocalFolder
False
<_CustomFiles Include="$(MSBuildProjectDirectory)\TargetFolder\**\*" />
TargetFolder\%(RecursiveDir)%(Filename)%(Extension)
copyAdditionalFilesOrFolderForDeploy;;
Powershell Gallery
What's Next
For deployment, you should use Visual Studio 2015's DevOps deployment tools.
Conclusion
Deploying ASP.NET web applications can be streamlined by configuring your project files and publish profiles to handle file copying automatically. For enterprise scenarios, consider using PowerShell scripts and Visual Studio's built-in DevOps tools for a more robust deployment pipeline.