【问题标题】:Azure Cloud Service and AfterBuild Target Access DeniedAzure 云服务和 AfterBuild 目标访问被拒绝
【发布时间】:2013-06-27 23:17:14
【问题描述】:

我在发布到 Cloud Azure 时尝试将多个 html 文件合并为一个,我将以下内容添加到 .csproj 文件中

  <Target Name="AfterBuild">
    <CreateItem Include="$(ProjectDir)js\ordering-widget\tpl\*.html">
      <Output TaskParameter="Include" ItemName="htmlFilesToCombine" />
    </CreateItem>

    <ReadLinesFromFile File="%(htmlFilesToCombine.FullPath)">
      <Output TaskParameter="Lines" ItemName="htmlLines" />
    </ReadLinesFromFile>

    <WriteLinesToFile File="$(ProjectDir)js\ordering-widget\tpl\combined.html" Lines="@(htmlLines)" Overwrite="true" /> 
  </Target> 

但是,我收到拒绝访问错误

$/Allegro Web/Allegro Web/Allegro Web.sln ('Allegro Web:Publish' target(s)) - 1 error(s), 1 warning(s),View log file
C:\a\src\Allegro Web\MvcWebRoleCore\MvcWebRoleCore.csproj (983): Could not write lines to file "C:\a\src\Allegro Web\MvcWebRoleCore\js\ordering-widget\tpl\combined.html". Access to the path 'C:\a\src\Allegro Web\MvcWebRoleCore\js\ordering-widget\tpl\combined.html' is denied.

这显然是一个天蓝色的权限错误,如何解决这个问题。谢谢。

【问题讨论】:

  • 您是发布到 Azure 网站还是 Azure Web 角色?
  • @IUnknown Azure 云服务,Azure Web 角色
  • 我还没来得及查看 tfsbuild 的目录宏到底是什么,但我发现我可以写入 c:\a\bin 目录,但不能写入 c:\a \src 目录。尝试改用 $(TargetDir) 或从 $(OutDir) 派生的东西。

标签: azure msbuild tfsbuild


【解决方案1】:

这与 azure 项目没有直接关系。

这是由于文件在磁盘上只读。您需要在脚本中添加一个步骤,并在您尝试写入的文件上添加属性 -r。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-22
    • 2018-05-01
    • 2021-02-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多