2013-06-27 44 views
1

我想发布到Azure的云时,几个HTML文件合并成一个,我添加了以下到的.csproj文件Azure的云服务和AfterBuild目标访问被拒绝

<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. 

显然是天蓝色的权限错误,该如何解决。谢谢。

+0

要发布到Azure网站还是发布Azure Web角色? – IUnknown

+0

@IUnknown Azure云服务,Azure Web角色 –

+0

我还没有时间查看tfsbuild的目录宏是什么,但我发现我可以写入c:\ a \ bin目录 - 但不是c :\ a \ src目录。尝试使用$(TargetDir)代替或从$(OutDir)派生的东西。 –

回答

1

这与azure项目直接无关。

这是由于文件只能在磁盘上读取。您需要在您的脚本中添加一个步骤,并在您要编写的文件上添加attrib -r。