2011-06-20 10 views
1

を実行する前に、データベースを展開する方法を私はHow to prepare database for TFS deployment walkthroughTFS2010チームビルド - ユニットテストに

に続き、私のビルドスクリプトが正常にビルドプロセスの最後でデータベースを展開します。しかし、ユニットテストを実行する前にデータベースを配備する必要があります。 私はステップをコピーし、「影響を受けたテスト、インデックスソースとパブリッシュシンボルを得る」の上に貼り付けました。しかし、ビルドプロセスは、次のエラーが返されます。

* The deployment manifest file Database_Core.deploymanifest does not exist Here is the excerpt from my xaml file for the database deploy:

     <Sequence DisplayName="Deploy Database" sap:VirtualizedContainerService.HintSize="486,330"> 
         <sap:WorkflowViewStateService.ViewState> 
          <scg:Dictionary x:TypeArguments="x:String, x:Object"> 
          <x:Boolean x:Key="IsExpanded">True</x:Boolean> 
          <x:Boolean x:Key="IsPinned">True</x:Boolean> 
          </scg:Dictionary> 
         </sap:WorkflowViewStateService.ViewState> 
         <If Condition="[BuildDetail.CompilationStatus &lt;&gt; BuildPhaseStatus.Failed]" DisplayName="If Build Succeeded" sap:VirtualizedContainerService.HintSize="464,206"> 
          <sap:WorkflowViewStateService.ViewState> 
          <scg:Dictionary x:TypeArguments="x:String, x:Object"> 
           <x:Boolean x:Key="IsPinned">True</x:Boolean> 
          </scg:Dictionary> 
          </sap:WorkflowViewStateService.ViewState> 
          <If.Then> 
          <mtbwa:InvokeProcess Arguments="[&quot;/a:Deploy /cs:&quot;&quot;Data Source=MyServer-SQL1\BUILD;Integrated Security=True;Pooling=False&quot;&quot; /dd+ /dsp:Sql /manifest:Database_Core.deploymanifest&quot;]" DisplayName="Invoke VSDBCMD" FileName="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Deploy\VSDBCMD.EXE" sap:VirtualizedContainerService.HintSize="219,100" WorkingDirectory="[BuildDetail.DropLocation]"> 
           <mtbwa:InvokeProcess.ErrorDataReceived> 
           <ActivityAction x:TypeArguments="x:String"> 
            <ActivityAction.Argument> 
            <DelegateInArgument x:TypeArguments="x:String" Name="errOutput" /> 
            </ActivityAction.Argument> 
            <mtbwa:WriteBuildError DisplayName="VSDBCMD Error" sap:VirtualizedContainerService.HintSize="200,22" Message="[errOutput]" /> 
           </ActivityAction> 
           </mtbwa:InvokeProcess.ErrorDataReceived> 
           <mtbwa:InvokeProcess.OutputDataReceived> 
           <ActivityAction x:TypeArguments="x:String"> 
            <ActivityAction.Argument> 
            <DelegateInArgument x:TypeArguments="x:String" Name="stdOutput" /> 
            </ActivityAction.Argument> 
            <mtbwa:WriteBuildMessage DisplayName="VSDBCMD Output" sap:VirtualizedContainerService.HintSize="200,22" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" Message="[stdOutput]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" /> 
           </ActivityAction> 
           </mtbwa:InvokeProcess.OutputDataReceived> 
           <sap:WorkflowViewStateService.ViewState> 
           <scg:Dictionary x:TypeArguments="x:String, x:Object"> 
            <x:Boolean x:Key="IsPinned">False</x:Boolean> 
           </scg:Dictionary> 
           </sap:WorkflowViewStateService.ViewState> 
          </mtbwa:InvokeProcess> 
          </If.Then> 
          <If.Else> 
          <mtbwa:WriteBuildWarning DisplayName="Deployment Skipped" sap:VirtualizedContainerService.HintSize="220,100" Message="Database deployment was skipped" /> 
          </If.Else> 
         </If> 
         </Sequence> 
+0

単体テストの実行前にデータベースの公開が実行されるようにビルド構成を調整できますか? – thekip

答えて

0

これはまさに私が必要としていたものです。

  1. が最初に私は私がターゲット・データベース・ホスト、ユーザー&パスワードを設定して、私のビルドプロセステンプレートに引数のセットを配置し:続くすべてのポイントを示しているhere PNGを参照してください。最初のスロットで
    • * .dbproj
    • :(「引数」を参照してください)
    • 場合には、現在のプロジェクトのユニットテストを実行しているDBを必要とする、私は2つの異なるプロジェクト「を構築するために項目」に設定しました第二にSLN自体
  2. は今すぐビルドプロセステンプレート内私はMSBuildの引数がで異なっていることをことを確実にすること、( 『シーケンス』を参照してください)シーケンスとして 『プロジェクトの実行のMSBuild』を展開しまし左ケース:
左側にMSBuildのための個の

引数(「MSBuildの+配備DBを実行する」):

String.Format("/p:SkipInvalidConfigurations=true /t:Build;Deploy /p:TargetConnectionString=""Data Source={0}%3Buser={1}%3Bpwd={2}"" /p:DeployToDatabase=true /p:TargetDatabase={3}_{4} {5}", 
      TargetMachineToDeployDB, DBUsername, DBPassword, DBName, BuildDetail.BuildNumber.Replace(".", "_"), MSBuildArguments) 

場合、それは、引数の間の接続あまりにも明白ではありません&定義における表示のparamsは、次のとおりです。
-
TargetMachineToDeployDB = "データベースを展開しなければならPC名" - DBUSERNAME = "データベースのユーザ名"
- DBPASSWORD = "データベースのパスワード"
- DBNAME = "データベースのプレフィックス名"(私は現在buildnameをCONCAT)

右側にMSBuildのための個の

引数(「SLN /プロジェクトのためのファイル名を指定して実行MSBuid」):私は左側にDBを展開した場合、私もTRUEに DBHasBeenSetを設定することを

String.Format("/p:SkipInvalidConfigurations=true {0}", MSBuildArguments) 

注意これは "ソースファイル内のアダプテーション"内のファイル処理をトリガします。これには、NUnit DLLを新しく構築されたDBにリダイレクトすることが含まれます。あなたが好きなら、私はそれについてさらに詳細を設定することができます。

0

これはあなたの展開で発生場所を変更することができます。

ワークフローでメインビルドコマンドの直後にデータベースを展開します。 2008年に.projを使用してこれを少しだけ明確にしました。これは単にそれを<Target Name=BeforeTest>に追加するためです。プロセスの前のポイントに移動してみてください。

関連する問題