【问题标题】:Build fails on Team Services在 Team Services 上构建失败
【发布时间】:2016-08-23 10:45:53
【问题描述】:

我在 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

现在,本地构建没有问题。直到最近它还在 Team Services 上构建,但出乎意料的是,没有任何真正的原因(没有任何更改),构建突然开始失败并出现以下错误:

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 这里有人可能有想法吗?

【问题讨论】:

  • 你能分享整个构建日志吗?
  • 我会将其添加到我的问题中。 :-)
  • 我已经包含了构建日志

标签: c# .net azure azure-devops


【解决方案1】:

错误 CloudServices089:在 SomeProject.Foreman 角色中找不到源目录“C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\ClientCustomCode”。 [C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\SomeProject.Cloud.ccproj]

install.cmd 用于创建目录并将程序集复制到新目录。从错误消息中,我认为 install.cmd 没有执行。也许 install.cmd 没有部署到工作角色。请在发布应用时通过启用远程桌面进行验证: 我们可以在worker角色实例的E:\approot目录下找到install.cmd。

请尝试在您的解决方案中找到 install.cmd,然后将复制到输出目录设置为始终复制,看看它是否有效,如下所示:

【讨论】:

  • 部署仍然有效,只是团队服务上的自动构建失败了。
猜你喜欢
  • 2017-11-26
  • 2015-04-15
  • 1970-01-01
  • 2013-12-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多