2016-08-23 121 views
0

我在Visual Studio 2015中有一個.NET Azure解決方案。該應用程序使用2個輔助角色。構建團隊服務失敗

作爲其功能的一部分,在構建過程中的某個時刻,將一些dll複製到雲項目中,以便最終得到最終結果。

爲了使工作我已在「ServiceDefinition.csdef中」以下內容:

<WorkerRole name="SomeProject.Foreman" vmsize="Small"> 
    <Contents> 
    <Content destination="ClientCustomCode"> 
     <SourceDirectory path="ClientCustomCode" /> 
    </Content> 
    </Contents> 
    <ConfigurationSettings> 
    <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" /> 
    <Setting name="SomeProjectDocumentDBURI" /> 
    <Setting name="SomeProjectAuthorizationKey" /> 
    <Setting name="LogLevel" /> 
    <Setting name="RequestQueue" /> 
    <Setting name="RequestErrorQueue" /> 
    <Setting name="NumberOfConcurrentRequests" /> 
    <Setting name="NumberOfRequestsToReadFromAzureQueue" /> 
    <Setting name="StorageConnectionString" /> 
    <Setting name="SomeProjectPnrHistory" /> 
    <Setting name="SomeProjectClientRepository" /> 
    <Setting name="SomeProjectMessagesInProcess" /> 
    </ConfigurationSettings> 
    <LocalResources> 
    <LocalStorage name="InstallLogs" sizeInMB="5" cleanOnRoleRecycle="false" /> 
    </LocalResources> 
    <Startup> 
    <Task commandLine="install.cmd" executionContext="elevated" taskType="simple"> 
     <Environment> 
     <Variable name="PathToInstallLogs"> 
      <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/LocalResources/LocalResource[@name='InstallLogs']/@path" /> 
     </Variable> 
     </Environment> 
    </Task> 
    </Startup> 
</WorkerRole> 

<WorkerRole name="SomeProject.Engine" vmsize="Small"> 
    <Contents> 
    <Content destination="ClientCustomCode"> 
     <SourceDirectory path="ClientCustomCode" /> 
    </Content> 
    </Contents> 
    <ConfigurationSettings> 
    <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" /> 
    <Setting name="RequestQueue" /> 
    <Setting name="RequestErrorQueue" /> 
    <Setting name="SomeProjectDocumentDBURI" /> 
    <Setting name="SomeProjectAuthorizationKey" /> 
    <Setting name="LogLevel" /> 
    <Setting name="NumberOfConcurrentRequests" /> 
    <Setting name="NumberOfRequestsToReadFromAzureQueue" /> 
    <Setting name="StorageConnectionString" /> 
    <Setting name="SomeProjectPnrHistory" /> 
    <Setting name="SomeProjectClientRepository" /> 
    <Setting name="SomeProjectMessagesInProcess" /> 
    </ConfigurationSettings> 
    <LocalResources> 
    <LocalStorage name="InstallLogs" sizeInMB="5" cleanOnRoleRecycle="false" /> 
    </LocalResources> 
    <Startup> 
    <Task commandLine="install.cmd" executionContext="elevated" taskType="simple"> 
     <Environment> 
     <Variable name="PathToInstallLogs"> 
      <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/LocalResources/LocalResource[@name='InstallLogs']/@path" /> 
     </Variable> 
     </Environment> 
    </Task> 
    </Startup> 
</WorkerRole> 

在雲項目中,我添加在構建事件如下:

-- Pre-build 
IF NOT EXIST $(TargetDir)ClientCustSomCode mkdir $(TargetDir)ClientCustomCode 

-- Post-build 
IF NOT EXIST $(TargetDir)ClientCustomCode mkdir $(TargetDir)ClientCustomCode 
copy $(ProjectDir)ClientCustomCode\*.dll $(TargetDir)ClientCustomCode 
copy $(ProjectDir)ClientCustomCode\*.pdb $(TargetDir)ClientCustomCode 

在項目文件複製的dll實際構建的位置:

copy $(TargetName).dll $(SolutionDir)SomeProject\SomeProject.Cloud\ClientCustomCode 
copy $(TargetName).pdb $(SolutionDir)SomeProject\SomeProject.Cloud\ClientCustomCode 

現在,在本地構建時沒有問題。直到最近,它也建立在團隊服務,但出了藍色,沒有任何真正的原因(沒有改變)構建突然開始失敗,出現以下錯誤:

2016-08-23T08:37:40.3013767Z C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\ServiceDefinition.csdef : error CloudServices089: Cannot find the source directory 'C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\ClientCustomCode' in role SomeProject.Foreman. [C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\SomeProject.Cloud.ccproj] 
2016-08-23T08:37:40.3013767Z C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\ServiceDefinition.csdef : error CloudServices089: Cannot find the source directory 'C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\ClientCustomCode' in role SomeProject.Engine. [C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\SomeProject.Cloud.ccproj] 

生成日誌文件:Download 這裏有人可能有想法嗎?

+0

可以共享整個構建日誌? –

+0

我會將其添加到我的問題。 :-) – Fysicus

+0

我已經包含構建日誌 – Fysicus

回答

0

error CloudServices089: Cannot find the source directory 'C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\ClientCustomCode' in role SomeProject.Foreman. [C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\SomeProject.Cloud.ccproj]

install.cmd用於創建目錄並將程序集複製到新目錄。從錯誤消息中,我認爲install.cmd未被執行。也許install.cmd不會部署到輔助角色。發佈應用程序時,請通過啓用遠程桌面進行驗證: enter image description here 我們可以在worker角色實例中的E:\approot目錄中找到install.cmd。

請嘗試找到INSTALL.CMD在您的解決方案,然後在複製設置輸出目錄爲始終複製,看它是否有效,如以下:

enter image description here

+0

部署仍然有效,它只是Team Services上的自動構建失敗。 – Fysicus

相關問題