2016-05-04 13 views
1

ソリューション内のすべてのプロジェクトに対してmsbuild /t:updateuid <project file>を簡単に実行する方法はありますか?ソリューション内のすべてのプロジェクトのmsbuild/t:updateuidの実行方法?

私は150以上のプロジェクトを持つ巨大なソリューションを持っており、ソリューションのすべてのプロジェクトですべての* .xamlファイルにUIDを設定したいと考えています。私はこの行をすべてのプロジェクトに追加するのではなく、1か所から実行したいと思います。したがって、私は簡単にコマンドの実行を制御することができます。 たとえば、開発フェーズでは、コマンドを無効にしてビルドプロセスを高速化し、テストフェーズの直前に1か所から有効にしたいと考えています。どんな提案も充分です。

よろしく

答えて

1

私はthisブログで情報を使用して私の問題を解決するために管理。 アイデアは、すべてのプロジェクトに対してmsbuildで処理されるカスタム.targetsファイルを挿入することです。

      • SolutionFolder MySolution.sln
      • after.MySolution.sln.targets
      • UpdateAutomationIds.targets

    after.MySolution.sln.targets:私たちは、以下の溶液構造を持っている想像してみてファイルはmsbuildによって処理されます。ソリューションのすべてのプロジェクトに対して実行されるファイルUpdateAutomationIds.targetsが挿入されます。 MySolutionをソリューションの名前に置き換えてください。

    after.MySolution.sln.targets

    <?xml version="1.0" encoding="utf-8"?> 
    <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
        <PropertyGroup> 
        <CustomAfterMicrosoftCommonTargets>$(MSBuildThisFileFullPath)</CustomAfterMicrosoftCommonTargets> 
        <SolutionPath>$(SolutionPath);CustomAfterMicrosoftCommonTargets=$(MSBuildThisFileDirectory)UpdateAutomationIds.targets</SolutionPath> 
        </PropertyGroup> 
    </Project> 
    

    UpdateAutomationIds.targets

    <?xml version="1.0" encoding="utf-8"?> 
    <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
        <Target Name="UpdateAutomationIds" Condition="'$(MSBuildProjectExtension)'=='.csproj'" BeforeTargets="Build"> 
        <Message Text="Updates automation ids. Project: $(MSBuildProjectFullPath)" Importance="high"/> 
        <Exec Command="&quot;$(MSBuildToolsPath)\msbuild.exe&quot; /t:updateuid &quot;$(MSBuildProjectFullPath)&quot;"/> 
        <Exec Command="&quot;$(MSBuildToolsPath)\msbuild.exe&quot; /t:checkuid &quot;$(MSBuildProjectFullPath)&quot;"/> 
        </Target> 
    </Project> 
    
  • 関連する問題