2

現在、プロジェクトのビルドに取り組んでいますが、TFS ビルドで問題に直面しています。
TFS ビルドを使用して、IIS Express のパラメーターを使用して zip パッケージを作成したいだけです。

CSPROJ 構成: ウェブ Web のパッケージ化/公開

私のマシンとビルド サーバーに IIS Express が存在します (プロジェクト内の *.svc ファイルにアクセスできます)。
そして、すべてがソース管理にあります。

自分のマシンで「Build Deployment Package」を使用すると、zip が取得されます。
ビルド サーバーで「Build Deployment Package」を使用すると、zip が取得されます。
両方で MSBuild のコマンド ラインを使用すると、zip を取得できます。

問題のコマンドライン:

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "C:\WORKSPACES\[...]\Project.csproj" /p:Platform=AnyCPU;Configuration=Release /p:DeployTarget=Package /p:DeployOnBuild=true;DefaultPackageFileName=ZipName.zip

しかし、同じコマンド ラインをビルドに入れると、失敗します。

"C:\Builds\2\[...]\Project.csproj" (default target) (1) ->
(PackageUsingManifest target) -> 
  C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009,5): error : Web deployment task failed.(Object of type 'manifest' and path 'C:\Builds\2\Project Release\Binaries\_PublishedWebsites\Project_Package\Project.SourceManifest.xml' cannot be created.) [C:\Builds\2\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009,5): error :  [C:\Builds\2\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009,5): error : Object of type 'manifest' and path 'C:\Builds\2\Project Release\Binaries\_PublishedWebsites\Project_Package\Project.SourceManifest.xml' cannot be created. [C:\Builds\2\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009,5): error : One or more entries in the manifest 'sitemanifest' are not valid. [C:\Builds\2\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009,5): error : Site '' does not exist. [C:\Builds\2\[...]\Project.csproj]

追加情報、3009行目は次を参照してください。

<VSMSDeploy Condition="!$(UseMsdeployExe)"
   MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
   Source="@(MsDeploySourceProviderSetting)"
   Destination="@(MsDeployDestinationProviderSetting)"
   DeploymentTraceLevel="$(PackageTraceLevel)"
   DisableLink="$(PackageDisableLinks)"
   EnableLink="$(PackageEnableLinks)"
   DeclareParameterItems="@(_Package_MsDeployDeclareParameters)"
   OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
   ImportDeclareParametersItems="$(_VsPackageParametersFile)"
   ReplaceRuleItems="@(MsDeployReplaceRules)"
   RetryAttempts="$(RetryAttemptsForDeployment)">

私は何かが欠けていることを知っていますが、何がわかりません...だから、提案があれば...それは大歓迎です! :)

ビルド サーバーにログオンしているときに、tfs ビルドが自分と同じアカウントで実行されませんでした。
IIS Express は tfs ビルドでうまく起動しますか?
を調べるとC:\Users\svcTfsBuild\Documents、私のユーザーと同様に IISExpress ディレクトリはありません (svcTfsBuild は TFS ビルドのサービス アカウントです)。

主な目標:

  • これらのパラメーター (zip パッケージ内の parameters.xml) を含む tfs ビルドを含む zip パッケージを取得します。
  • また
  • インポート時にアプリケーション プールと物理パスを指定できる zip パッケージを用意します。

このような:

<parameters>
  <parameter name="IIS Web Application Name" defaultValue="Default Web Site/Project" tags="IisApp">
    <parameterEntry kind="ProviderPath" scope="AppHostConfig" match="^ProjectTest/Project$" />
    <parameterEntry kind="ProviderPath" scope="contentPath" match="^C:\\WORKSPACES\\[...]\\obj\\Release\\Package\\PackageTmp$" />
    <parameterEntry kind="ProviderPath" scope="setAcl" match="^C:\\WORKSPACES\\[...]\\obj\\Release\\Package\\PackageTmp$" />
  </parameter>
  <parameter name="IIS Web Application Pool Name" defaultValue="ASP.NET v4.0">
    <parameterEntry kind="DeploymentObjectAttribute" scope="application" match="application[@applicationPool='Clr4IntegratedAppPool']/@applicationPool" />
  </parameter>
  <parameter name="IisVirtualDirectoryPhysicalPath" defaultValue="D:\CompanyName\Project" tags="PhysicalPath">
    <parameterEntry kind="DestinationVirtualDirectory" scope=".*" match="^C:\\WORKSPACES\\[...]$" />
  </parameter>
</parameters>

注:ワークスペースは私たちのマシン、tfsビルドサーバーでは同じではないため、csprojで直接parameters.xmlで構成を指定できます...

これが明確であることを願っています

編集:drkからの提案

あなたが言ったように、私はサービスアカウントからコマンドラインを実行し、特にこれを得ました:

GenerateMsdeployManifestFiles:
  Generate source manifest file for Web Deploy package/publish ...
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: The "IsCleanMSDeployPackageNeeded" task failed unexpectedly. [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Web.Deployment.DeploymentException: Object of type 'package' and path 'C:\WORKSPACES\[...]\obj\Release\Package\Project.zip' cannot be created. ---> Microsoft.Web.Deployment.DeploymentException: The Zip package 'C:\WORKSPACES\[...]\obj\Release\Package\Project.zip' could not be loaded. ---> System.UnauthorizedAccessException: Access to the path 'C:\WORKSPACES\[...]\obj\Release\Package\Project.zip' is denied. [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Deployment.Win32Native.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Deployment.FileStreamEx.CreateInstance(String path, FileMode fileMode, FileAccess fileAccess, FileShare fileShare) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Deployment.ZipFile.Load() [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Deployment.ZipPackageProvider..ctor(DeploymentProviderContext providerContext, DeploymentBaseContext baseContext, String path) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    --- End of inner exception stack trace --- [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Deployment.ZipPackageProvider.GetAttributes(DeploymentAddAttributeContext addContext) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Deployment.DeploymentObject.EnsureValidAttributes() [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    --- End of inner exception stack trace --- [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Deployment.DeploymentManager.CreateObjectPrivate(DeploymentProviderContext providerContext, DeploymentBaseOptions baseOptions, DeploymentObject sourceObject) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Deployment.DeploymentManager.CreateObject(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Deployment.DeploymentManager.CreateObject(String provider, String path, DeploymentBaseOptions baseOptions) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Deployment.DeploymentManager.CreateObject(DeploymentWellKnownProvider provider, String path) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    --- End of inner exception stack trace --- [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Publishing.Tasks.DynamicAssembly.CallStaticMethod(String typeName, String methodName, Object[] arguments) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Web.Publishing.Tasks.IsCleanMSDeployPackageNeeded.Execute() [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) [C:\WORKSPACES\[...]\Project.csproj]
Done Building Project "C:\WORKSPACES\[...]\Project.csproj" (default targets) -- FAILED.

Build FAILED.

サービス アカウント (私の場合は SvcTfsBuild) を確認しました。彼はワークスペース (つまりソース コード) を完全に制御できます。また、私のアカウントと SvcTfsBuild アカウントは同じグループ (ローカル管理者) にあります。

しかし、TFS BUILD ログ (詳細モード) には、アクセス許可の問題は示されませんでした...

編集 2013/03/25

[Web] タブの [IIS Express を使用する] チェックボックスをオフにしました。
ビルドにより、適切な zip パッケージが生成されます。
したがって、IIS Express だけに問題があると思います。

ビルドでは、「CreateLabel」の直後のシーケンス「Run On Agent」に「InvokeProcess」がありました。
これらの引数を使用して ISS Express を起動します。

/site:Project-Site

ログ ファイルでは、Result が 0 になっています (つまり、ISS Express が正常に起動していると仮定します。そうでない場合は、例外がスローされるはずです)。ただし、コマンド ラインの形式が適切でないか間違っている場合 (つまり、/site と /path を組み合わせることはできません)、結果も 0 になります
。そのように ISS Express を起動すると、ビルドが停止します (iisexpress は a を待機します)。停止するか、単に聞くための手動アクション)。

編集2 2013/03/25

ビルドと同時に IIS Express を起動するために、次のようにしました。 TFBUILD

Parallel では、ビルド プロセスの Final で True に設定されている「BuildFinished」という名前の変数があります (左側)。

しかし、再び同じエラーが発生しました (サイト '' が存在しません)。

「Build Deployment Package」(VS2010) と TFBUILD を使用してビルドすると、2 つの Project.SourceManifest.xml の違いも見つかりました。

展開パッケージのビルド:

<?xml version="1.0" encoding="utf-8"?>
<sitemanifest>
  <appHostConfig path="Project-Site/Project" />
  <contentPath path="C:\WORKSPACES\Project\obj\Release\Package\PackageTmp" />
  <setAcl path="C:\WORKSPACES\Project\obj\Release\Package\PackageTmp" setAclResourceType="Directory" />
  <setAcl path="C:\WORKSPACES\Project\obj\Release\Package\PackageTmp" setAclUser="anonymousAuthenticationUser" setAclResourceType="Directory" />
</sitemanifest>

TFBUILD :

<?xml version="1.0" encoding="utf-8"?>
<sitemanifest>
  <appHostConfig path="/Project" />
  <contentPath path="C:\Builds\1\Project\obj\Release\Package\PackageTmp" />
  <setAcl path="C:\Builds\1\Project\obj\Release\Package\PackageTmp" setAclResourceType="Directory" />
  <setAcl path="C:\Builds\1\Project\obj\Release\Package\PackageTmp" setAclUser="anonymousAuthenticationUser" setAclResourceType="Directory" />
</sitemanifest>

パスの値が同じではありません。

4

1 に答える 1

2

数回試行した後、問題は IIS Express と MSDeploy の間で動作しないことにあると思います (これは " Site '' does not exist." と表示されているものです)。

そのため、動作させることを試みるのではなく、動作する構成を使用するように考えを変えます。IIS を使用するために、ビルド プロセス中に csproj を変更します。

手順 1: ビルド サーバー上の IIS

  1. アプリケーション プールを作成します。重要なのは、名前とフレームワークのバージョンです。これ以上何もない。
  2. アプリケーションを作成します。名前とアプリケーション プールは重要です。C:\temp を物理パスとして使用できます。

ステップ 2: ビルドの定義
2 つの選択肢があります。カスタム ビルド アクティビティを作成する (より良い方) か、xaml 内で実行する (醜い方)。
目標は、次の手順を実行することです。

  1. 「Run On Agent」シーケンスで、「If Create Label」の直後
  2. 対象の csproj (TFS によって作成されたワークスペースにあるもの) の readonly 属性を削除します。
  3. csproj の内容を読む
  4. 次の XML タグを置き換えます

<UseIISExpress>True</UseIISExpress>by <UseIISExpress>False</UseIISExpress>
<UseIIS>False</UseIIS>by <UseIIS>True</UseIIS>
<IncludeIisSettings>False</IncludeIisSettings>by <IncludeIisSettings>true</IncludeIisSettings>
<IISUrl>{IIS Express URL}</IISUrl>by <IISUrl>{IIS URL}</IISUrl>
/!\ 注意: ブール値は True または True のいずれかになります。
/!\ 注意 2: Cassini を使用している場合、IISUrl のタグは、次のようにワード ラップを含む場合があります。

`<IISUrl>  
</IISUrl>`  

これは、4 人の開発者のマシンの 1 つでのみ発生しました。

{IIS Express URL}: IIS Express と同様http://localhost:8080/、またはhttp://localhost:8080/ApplicationCassini と空です。
{IIS URL}: のようなものhttp://localhost/Applicationです。

 
最後に、csproj (ソース管理ではなく、TFS のワークスペースにあるもの) を変更内容で上書きします。

{IIS Express URL} と {IIS URL} はビルドからの引数にすることができますが、ビルドが csproj を 1 つずつ取得する場合に限ります (1 ビルド = 1 zip パッケージなので、1 つの csproj を変更する必要があります)。

 
 
その解決策 (私が知らないより良い解決策があると思います) では、動作することがわかっている構成を使用します。

zip パッケージが IIS にインポートされると、アプリケーション プールと物理パスが変更される可能性があります。
これが私たちの目標です。

お役に立てれば。

于 2013-04-04T08:52:45.447 に答える