2009-06-22 9 views

cevap

17

Tüm İçerik dosyalarının fiziksel olarak diskte yer aldığından emin olmak için bir hedef oluşturabilir ve durum böyle değilse bir hata ortaya çıkarabilirsiniz. İşte bu hedef InitialTargets Proje elemana özellik ekleyerek her şey yürütülür emin olabiliriz böyle bir hedef

<Target Name="ValidateContentFiles"> 
    <Error Condition="!Exists(%(Content.FullPath))" 
     Text="Missing Content file [%(Content.FullPath)]"/> 
</Target> 

olduğunu. Örneğin

<Project InitialTargets="ValidateContentFiles" 
     ToolsVersion="3.5" DefaultTargets="Build" 
     xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 

Sayed Ibrahim Haşimi

My Kitap: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build

0

Ayrıca böyle .csproj içinde BeforeBuild Hedef mevcut içinde hata durumunu ekleyebilirsiniz:

<Target Name="BeforeBuild"> 
<Error Condition="!Exists(%(Content.FullPath))" 
Text="Missing Content file [%(Content.FullPath)]"/> 
</Target> 

BeforeBuild her zaman inşa ederken yürütecek Bir proje ve böylece Project özelliğinin InitialTargets özniteliğine hedefi eklemeniz gerekmez.