Capture

padds_build_automation.cmd

net use * /delete /y
net use X: \\cdtssyb04d\D$\transfer
SET projectFile=C:\DRIVE\WebProject\PADDSLite.csproj
SET publishProfile=C:\DRIVE\WebProject\Properties\PublishProfiles\deployToFilesystem.pubxml
msbuild %projectFile% /p:DeployOnBuild=true /p:PublishProfile=%publishProfile%
SET copySource=C:\DRIVE\PADDS\PADDSBuildAutomation\DeployedFiles
SET copyDestination=X:\8082_PADDS_LITE\COPY
C:\DRIVE\PADDS\PADDSBuildAutomation\copy_script.cmd %copySource% %copyDestination%
QUIIT

Capture.PNG

 

 

copy_script.cmd

SET source=%1
SET destination=%2
SET copyCommand=/Y
SET copyCommand2=/S
xcopy %copyCommand% %source% %destination% %copyCommand2%
   if %ERRORLEVEL% NEQ 0 (
          echo file copy failed
   ) else (
        echo file copy success
      )

Capture

 

Mapping:

The net use command is a Command Prompt command that’s used to connect to, remove, and configure connections to shared resources, like mapped drives and network printers.

net use DRIVE: PATH

Disconnect from a share
 NET USE [driveletter:] /DELETE

Disconnect from a share and close all resources (undocumented)
 NET USE [driveletter:] /DELETE /Y

Map a drive using alternate credentials – this will prompt for a password
 NET USE G: \\Server64\Share1 /USER:SS64dom\user64
DRIVE is the drive letter you want to use and PATH is the full UNC path to the share. So, for example, if we wanted to map drive letter S to the share \\tower\movies, we’d use the following command:

net use s: \\tower\movies

You can disconnect a mapped drive using ‘net use /delete’ command.
If you ever need to delete a mapped network drive, all you have to do is specify the drive letter and add the /delete switch. For example, the following command would delete the drive mapping we assigned to drive S:

net use s: /delete

You can also use the asterisk as a wildcard should you ever want to delete all your mapped drives in one go:

net use * /delete

 

If the share to which you’re connecting is protected with some sort of authentication, and you’d rather not type in the credentials every time you open the network drive, you can add the user name and password to the command with the /user: switch. For example, if we wanted to connect the same share from above, but with the username HTG and the password CrazyFourHorseMen, we’d use the command:

net use s: \\tower\movies /user:HTG CrazyFourHorseMen

 

Capture.PNG

 

SET:

Displays, sets, or removes cmd.exe environment variables.

Display, set, or remove CMD environment variables. Changes made with SET will remain only for the duration of the current CMD session.

Syntax
      SET variable
      SET variable=string

 

 

Usually, you would want to avoid bloating build-server with the whole Visual Studio installation. Instead, you can leverage the MSBuild command-line tool to build your application. Following are few ways you can use msbuild.exe

 

 

Prerequisites:

Build Tools for Visual Studio 2017 ( or for your version of VS)

Optional: you could add MSBuild location to your System Environments Variable for easy access.

You can find the MSBuild exe in

 C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin

Build a solution:

msbuild  NameOfYourSoution.sln

Build a specific project

msbuild NameOfYourProject.csproj

Specifying MSBuild Configuration parameter:

msbuild NameOfYourProject.csproj /p:Configuration=Release

projectFile:

Capture.PNG

 

publishProfile:

Capture.PNG

 

<?xml version=”1.0″ encoding=”utf-8″?>
<!–
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
–>
<Project ToolsVersion=”4.0″ xmlns=”http://schemas.microsoft.com/developer/msbuild/2003″&gt;
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>C:\DRIVE\PADDS\PADDSBuildAutomation\DeployedFiles</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>

Capture

 

 

Source:

Capture

 

Destination :

Capture.PNG