1

TFS展開用にデータベースを準備する方法のチュートリアルに従いました

私のビルド スクリプトは、ビルド プロセスの最後にデータベースを正常にデプロイします。ただし、単体テストを実行する前にデータベースをデプロイする必要があります。ステップをコピーして、「Get Impacted Tests, Index Sources and Publish Symbols」の真上に貼り付けてみました。ただし、ビルド プロセスは次のエラーを返します。

*配置マニフェスト ファイル Database_Core.deploymanifest が存在しません データベース配置の xaml ファイルからの抜粋を次に示します。

                        <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>
4

2 に答える 2

0

デプロイメントでこれが発生する場所を変更できます。

ワークフローのメイン ビルド コマンドの直後にデータベースをデプロイします。2008 年に .proj を使用すると<Target Name=BeforeTest>、プロセスの早い段階に移動してみてください。

于 2011-06-20T20:14:51.260 に答える
0

これもまさに私が必要としていたものです。以下のすべてのポイントを示す PNG を参照してください

  1. 最初に、ビルド プロセス テンプレートに一連の引数を配置し、ターゲット データベース ホスト、ユーザー、およびパスワードを設定しました。(「引数」セクションを参照)
  2. 現在のプロジェクトの単体テストで実行中の DB が必要な場合に備えて、「ビルドする項目」に 2 つの異なるプロジェクトを設定します。
    • 最初のスロットの *.dbproj
    • 2 番目の SLN 自体
  3. ビルド プロセス テンプレート内で、"Run MSBuild for project" を Sequence として展開し ("Sequence" を参照)、MSBuild 引数が左のケースで異なることを確認します。

左側の MSBuild の引数 ("Run MSBuild + Deploy 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)

あまり 明白ではない場合、定義内の引数と表示されたパラメーターの間の接続は次のとおり
です 。 「データベース プレフィックス名」(現在のビルド名を連結します)


右側の MSBuild の引数 ("Run MSBuid for SLN/Project"):

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

左側に DB をデプロイした場合は、DBHasBeenSetもTRUE に設定することに注意してください。これにより、「ソース ファイルの適応」内のファイル処理もトリガーされます。これらには、NUnit DLL を新しく構築された DB にリダイレクトすることが含まれます。ご希望があれば、詳細を設定できます。

于 2011-06-21T11:38:32.313 に答える