.NET Daily

How to prepare an ASP.NET Website for deployment with PowerShell

Introduction

Darius

Darius

Darius Dumitrescu is a creative Senior CMS Consultant with in depth .NET knowledge, focused on Web Development and Architecture Design.


LATEST POSTS

My View of a JIRA Workflow for Web Development 17th April, 2018

How To Solve: SQL Server detected a logical consistency-based I/O error: invalid protection option. 19th March, 2018

Tutorials

How to prepare an ASP.NET Website for deployment with PowerShell

Posted on .

Visual Studio has some very good publishing and deployment tools but when it comes to solution deployment that is also a component of stand-alone product, things get complicated because usually you have to select certain folders or certain files to move them to production or to staging server.

I did a lot of research to see what is the best and easy solution for publishing custom parts of a project and the most versatile solution I found is Windows PowerShell. I found this tool to be fairly easy to use, highly customizable and with a very good community to help you understand the “language” that it uses.

Next I want to show you a piece of PowerShell script than can copy your website files to a temporary location, deletes the unwanted file types and then archives your folder to be ready to be moved to your staging or production server.
Please see the code below and the inline comments to understand it:

To execute the script, you have to put the code into a file with .ps1 extension and then you have to right click on the file and choose the “Run with PowerShell“.

You can download the demo script from below the post.

Attachments

Darius

Darius

Darius Dumitrescu is a creative Senior CMS Consultant with in depth .NET knowledge, focused on Web Development and Architecture Design.

There are no comments.

View Comments (0) ...
Navigation