[個人筆記] Jenkins 疑難雜症 (Deploy、Permission)

  • 1417
  • 0
  • 2020-01-15

純屬個人筆記

可能要搭配另一則貼文

https://dotblogs.com.tw/momobear/2017/07/09/112401   

(以Windows Sever 2012 安裝Jenkins環境 (VS建置設定、Plugin安裝)

前公司使用 VS2015 + 4.5 framwork

新公司使用 VS2017 + 4.6.2 framework

但是以前曾經可以work的 MSBuild指令卻失效了

 

問題一

使用MSBuild 執行以下指令

但是僅出現 BuildSuccess ( 0 Errors) 但是沒有執行後續 Deploy動作

"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" WebApplication2.csproj /p:DeployOnBuild=true /p:PublishProfile="FolderProfile"

解決辦法,把MSBuild版本提高
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64\MSBuild.exe" WebApplication2.csproj /p:DeployOnBuild=true /p:PublishProfile="FolderProfile"
 

 

問題二

build的時候,出現 4.5 net framwork錯誤

可能是因為 Web相關的 .net framework未正確安裝

解決辦法: 補安裝(我是使用VS安裝工具) Web相關的套件

 

其他備註

Jenkins有多個備份config檔案的plugin (但同事說 Thinbackup這個不好用)

請注意Deploy要加參數 xxxxtrust=true 信任對方機器授權那個

 

指令備份

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" website.publishproj /p:Configuration=Debug /p:Platform="AnyCPU" /p:DeployOnBuild=true /p:AllowUntrustedCertificate=True /p:PublishProfile="VM_MarshallBO" /p:Password="XXXXXXXXXXXXXXXXXXXX" /p:VisualStudioVersion=15.0

 

管理 Jenkins -> Manage and Assign Roles

 


Manage and Assign Roles 頁面

Project roles 功能分類:  

1. Role to add 填寫可識別名稱

2. 填寫要設定給人CRUD的 Jenkins Project (Job) 名稱

儲存Save (別忘了)

 

 Assign Roles 頁面

Item roles 功能分類:

賦予對應的使用者,勾選剛剛加的Project權限命名

儲存Save (別忘了)


 

 

 

cd %WORKSPACE%
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" PGS.API.ALL.sln