CI/CD – ASP MVC Application


In the series of Jenkins Post, I would like to share another set of job configuration for CI/CD for ASP MVC Application, with NPM configuration as well.

Pre-Requisite: Jenkin installed on the Windows 2016 Server, With Visual Studio Team Explorer 2017 for TF CLI.

Step 1: Download the latest source code from the TFS (Azure DevOps) Repo

SET Path=%PATH%;"C:\Program Files (x86)\Microsoft Visual Studio\2017\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer";
cd C:\tfs
tf get /,devoppwd /noprompt

Step 2: Download the NuGet packages configured for the project

cd c:\build\nuget
nuget restore "C:\tfs\Web\BIPortal\BIPortal.sln"

Step 3: Configure the NodeJs and its config for build npm packages

SET Path=%PATH%;"C:\Program Files\nodejs";
cd C:\tfs\Web\BIPortal\BIPortal
npm install

Step 4: Build the ASP MVC project, using the publish profile build the release file set

SET Path=%PATH%;"C:\Program Files\nodejs";
cd C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
MSBuild "C:\tfs\Web\BIPortal\BIPortal.sln" /property:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile="C:\tfs\Web\BIPortal\BIPortal\Properties\PublishProfiles\FolderProfile.pubxml"

Step 5: Clear and copy over the files on the Web Server (Deployment)

powershell.exe Remove-Item \\webserver\c$\biportal\* -Recurse -Force
powershell.exe Copy-Item -Path "C:\tfs\Web\BIPortal\BIPortal\bin\Release\Publish\*" -Destination "\\webserver\c$\biportal" -recurse -Force

I hope the above helps.

Leave a Reply

Your email address will not be published. Required fields are marked *