Created
March 28, 2017 20:47
-
-
Save andrecarlucci/77edf2eea6ca13320eff687859147f57 to your computer and use it in GitHub Desktop.
Script for publishing an asp.net microservice on my local IIS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
SETLOCAL | |
SET project=%1 | |
SET service=%2 | |
SET dir=%3 | |
IF [%1] == [] GOTO ERROR_USAGE | |
IF [%2] == [] GOTO ERROR_USAGE | |
IF [%3] == [] GOTO ERROR_USAGE | |
SET cmd=C:\Windows\System32\inetsrv\appcmd.exe | |
SET dns=%project%-%service% | |
SET publishDir=%dir%\%project%\%service% | |
ECHO Publish Project Script | |
ECHO Project : %project% | |
ECHO Service : %service% | |
ECHO Pub dir : %publishDir% | |
ECHO DNS : %dns% | |
CD %project%.%service%\%project%.%service% | |
IF ERRORLEVEL 1 GOTO FAIL | |
ECHO Stopping IIS Service | |
%cmd% stop site /site.name:%dns% | |
ECHO | |
ECHO Building %service% | |
dotnet restore | |
msbuild /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile.pubxml /p:PublishUrl="%publishDir%" /p:PublishDestination="%publishDir%" | |
IF ERRORLEVEL 1 GOTO FAIL | |
ECHO Starting IIS Service | |
%cmd% start site /site.name:%dns% | |
CD .. | |
CD .. | |
ENDLOCAL | |
GOTO EOF | |
:ERROR_USAGE | |
ECHO Usage: configureiis.bat [project] [service name] [base directory] | |
GOTO EOF | |
:FAIL | |
ECHO Error building %service%. | |
:EOF | |
ECHO END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment