40.Station-publish.bat 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. @echo off
  2. ::enable delayed arguments
  3. setlocal EnableDelayedExpansion
  4. :: #1 get basePath
  5. set curPath=%cd%
  6. cd /d "%~dp0"
  7. cd /d ../../..
  8. set basePath=%cd%
  9. :: #2 get netVersion
  10. set netVersion=net6.0
  11. for /f "tokens=3 delims=><" %%a in ('type %basePath%\dotnet\ServiceCenter\App.ServiceCenter\App.ServiceCenter.csproj^|findstr "<TargetFramework>.*TargetFramework"') do set netVersion=%%a
  12. set publishPath=%basePath%/Publish/release/release/Station(%netVersion%)
  13. echo publish Station
  14. echo dotnet version: %netVersion%
  15. :: #3 find projects and publish
  16. for /f "delims=" %%f in ('findstr /M /s /i "<publish>" *.csproj') do (
  17. ::get name
  18. for /f "tokens=3 delims=><" %%a in ('type "%basePath%\%%f"^|findstr "<publish>.*publish"') do set name=%%a
  19. echo publish !name!
  20. ::publish
  21. cd /d "%basePath%\%%f\.."
  22. dotnet build --configuration Release
  23. dotnet publish --configuration Release --output "%publishPath%\!name!"
  24. @if errorlevel 1 (echo . & echo . & echo error & pause)
  25. ::copy xml
  26. xcopy "bin\Release\%netVersion%\*.xml" "%publishPath%\!name!" /i /r /y
  27. )
  28. :: #4 copy dir
  29. xcopy "%basePath%\Publish\ReleaseFile\Station" "%publishPath%" /e /i /r /y
  30. :: #5 copy ServiceCenter
  31. xcopy "%publishPath%\ServiceCenter" "%basePath%\Publish\release\release\ServiceCenter(%netVersion%)\ServiceCenter" /e /i /r /y
  32. xcopy "%publishPath%\01.ServiceCenter.bat" "%basePath%\Publish\release\release\ServiceCenter(%netVersion%)"
  33. xcopy "%publishPath%\01.Start-4580.bat" "%basePath%\Publish\release\release\ServiceCenter(%netVersion%)"
  34. echo %~n0.bat success
  35. cd /d "%curPath%"