2013-06-27 45 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。