2016-08-23 125 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

相关问题