zoukankan      html  css  js  c++  java
  • [bash-shell]构建WebAPI项目并且发布到本地

    :: 清理log文件
    del /S *.log
    
    echo Publish parameters initializing...
    
    ::These parameters are not used for the time being
    ::set DotNetFrameworkPath=%windir%Microsoft.NETFramework
    ::if exist %windir%SysWOW64 set DotNetFrameworkPath=%windir%Microsoft.NETFramework64
    
    :Set user level's parameters
    set SolutionPath=%~dp0..
    set SolutionName=ERP
    set SolutionFile="%SolutionPath%%SolutionName%.sln"
    set ProjectNames=API1 API2 API3
    set PackageNames=API1 API2 API3 Job
    set BuildPath=%~dp0..Builds
    set ZipExe="C:Program Files7-Zip7z.exe"
    set IfUseNuGetReStore=N % value is Y or N %
    set IfUpdateNuGetTool=N % value is Y or N %
    
    :Set system level's parameters
    set Configuration=Debug
    set LogLevel=normal
    :: Note: That the MSBuild tool version and VisualStudio version and the TargetFramework version have dependencies
    set MsBuildToolsVersion=14.0
    set TargetFrameworkVersion=4.5
    
    set MSBuildPath=C:Program Files (x86)MSBuild\%MsBuildToolsVersion%Bin
    set MSBuildExe="%MSBuildPath%MSBuild.exe"
    
    set MSBuildBuildArgs=/t:Rebuild /toolsversion:%MsBuildToolsVersion% /verbosity:%LogLevel% /logger:FileLogger,Microsoft.Build.Engine;encoding=utf-8;append=true;logfile="%BuildPath%%SolutionName%_Build_%Configuration%.log" /p:Configuration=%Configuration%
    
    set NuGetPath=%SolutionPath%.nuget
    set NuGetExe="%NuGetPath%NuGet.exe"
    set NuGetArgs=restore %SolutionFile%
    
    echo Publish parameters initialize completed.
    
    :: 更新NuGet包
    if %IfUseNuGetReStore% == Y (
    	if %IfUpdateNuGetTool% == Y (
    		echo NuGet tools Start updating...
    		%NuGetExe% update -Self
    		echo NuGet tools update completed.
    	) else (
    		echo Not update NuGet tools.
    	)
    	echo NuGet Start ReStoreing...
    	%NuGetExe% %NuGetArgs%
    	echo NuGet ReStore completed.
    ) else (
    	echo Not use NuGet tools.
    )
    
    :: 构建解决方案
    echo Start solution building...
    %MSBuildExe% %SolutionFile% %MSBuildBuildArgs%
    echo Build solution completed.
    
    :: Win项目发布
    echo Start JobConsole project publishing...
    %MSBuildExe% "%SolutionPath%JobConsoleJobConsole.csproj" /t:Rebuild /verbosity:%LogLevel% /logger:FileLogger,Microsoft.Build.Engine;encoding=utf-8;append=true;logfile="%BuildPath%JobConsole_Publish_%Configuration%.log" /p:Configuration=%Configuration% /p:Platform=AnyCPU /p:OutputPath="%BuildPath%JobConsole"
    echo Publish JobConsole project completed.
    
    :: Web项目发布
    (for %%p in (%ProjectNames%) do (
    	echo Start %%p project publishing...
    	%MSBuildExe% "%SolutionPath%%%p\%%p.csproj" /t:WebPublish /verbosity:%LogLevel% /logger:FileLogger,Microsoft.Build.Engine;encoding=utf-8;append=true;logfile="%BuildPath%%%p_Publish_%Configuration%.log" /p:Configuration=%Configuration% /p:Platform=AnyCPU /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl="%BuildPath%%%p"
    ))
    
    :: 7-zip打包
    (for %%p in (%PackageNames%) do (
    	echo Start %%p project packing...
    	%ZipExe% a -t7z "%BuildPath%%%p_%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%.7z" "%BuildPath%%%p/*" -r -x!*.config -x!*bak
    	echo Pack %%p project completed.
    ))
    
    
  • 相关阅读:
    chapter1 Qt入门
    base64加密解密
    vue+CryptoJS+cookie实现保存账号密码
    js计时器
    Elenent ui中的表单校验规则、自定义校验规则、预验证功能
    js获取文件后缀
    js中如何将有字符串转换为数组,或将数组转换为字符串
    vue-router
    Vue项目纯前端导出word文档
    async/await
  • 原文地址:https://www.cnblogs.com/VAllen/p/build-webapi-of-shell.html
Copyright © 2011-2022 走看看