2009-02-17 9 views
3

E.g. Я хочу назвать эти сценарии, проходящие Diff Params каждый раз:Как вы рекурсивно вызываете задачи в MSBuild?

<ItemGroup> 
     <SqlFiles Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\Tables\*.sql" /> 
     <SqlFiles Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\Functions\*.sql" /> 
     <SqlFiles Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\Views\*.sql" /> 
     <SqlFiles Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\ForeignKeys\*.sql" /> 
     <SqlFiles Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\StoredProcedures\*.sql" /> 
     <SqlFiles Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\Data\*.sql" /> 
</ItemGroup> 

ответ

2

Вы могли бы к тому, что с помощью MSBuild задачи с Свойства.

<!-- Dont itemize sql files now, if you want to differenciate the task operations --> 
<ItemGroup> 
    <SqlDirs Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\Tables" /> 
    <SqlDirs Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\Functions" /> 
    <SqlDirs Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\Views" /> 
    <SqlDirs Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\ForeignKeys" /> 
    <SqlDirs Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\StoredProcedures" /> 
    <SqlDirs Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\Data" /> 
</ItemGroup> 


<Target Name="MainTask"> 
    <MSBuild Projects="$(MSBuildProjectFile)" 
      Properties="SqlDir=%(SqlDirs.Fullpath)" 
      Targets="RecursivelyCalledTask"> 
    <Output ItemName="ProjSources" TaskParameter="TargetOutputs"/> 
    </MSBuild> 
</Target> 

<Target Name="RecursivelyCalledTask"> 
    <!-- We create here the SqlFiles items based on SqlDir--> 
    <CreateItem Include="$(SqlDir)\*.sql"> 
    <Output ItemName="SqlFiles" TaskParameter="Include"/> 
    </CreateItem> 

    <Message Text="SqlFiles -> @(SqlFiles)"/> 
</Target> 

 Смежные вопросы

  • Нет связанных вопросов^_^