BTDF / DeploymentFramework

The Deployment Framework for BizTalk is the most powerful and customizable, yet easy-to-use toolkit for deploying and configuring your BizTalk solutions.
MIT License
53 stars 24 forks source link

DeploymentFramework.BuildTasks.PublishWcfServiceArtifacts #418

Open tfabraham opened 6 years ago

tfabraham commented 6 years ago

I have set up deployment of an IIS virtual directory and also included the artifacts in a web project in my solution. I have modified the csproj according to the documentation to generate the WCF artifacts. All works great on my development machine.

When I try to build the solution at the TFS Build server I get the following unhelpful error(long paths and names removed for readability): 11:50:09.077 28>Target "AfterBuild: (TargetId:1183)" in project "C:\Builds\68**.InvoiceHub.IIS.csproj" (target "Build" depends on it): Using "DeploymentFramework.BuildTasks.PublishWcfServiceArtifacts" task from assembly "C:\Builds\68*\ExternalReferences\BizTalkDeploymentFramework.Tasks.dll". Task "DeploymentFramework.BuildTasks.PublishWcfServiceArtifacts" (TaskId:816) Exporting WCF service artifacts from WcfServiceDescription.xml... (TaskId:816) 11:50:09.339 28>C:\Builds\68**.InvoiceHub.IIS.csproj(104,5): error : Exception has been thrown by the target of an invocation. Done executing task "DeploymentFramework.BuildTasks.PublishWcfServiceArtifacts" -- FAILED. (TaskId:816) 11:50:09.340 28>Done building target "AfterBuild" in project ".InvoiceHub.IIS.csproj" -- FAILED.: (TargetId:1183) 11:50:09.340 28>Done Building Project "C:\Builds\68*\.InvoiceHub.IIS.csproj" (default targets) -- FAILED.

This is the log with verbosity: Diagnostic

Compared to the log on my local development machine: 1>Target "AfterBuild: (TargetId:67)" in project "C:\Dev**.InvoiceHub.IIS.csproj" (target "Build" depends on it): 1>Using "DeploymentFramework.BuildTasks.PublishWcfServiceArtifacts" task from assembly "C:\Dev*\ExternalReferences\BizTalkDeploymentFramework.Tasks.dll". 1>Task "DeploymentFramework.BuildTasks.PublishWcfServiceArtifacts" (TaskId:33) 1> Task Parameter:ServiceDescriptionPath=WcfServiceDescription.xml (TaskId:33) 1> Task Parameter:OutputPath=.\ (TaskId:33) 1> Exporting WCF service artifacts from WcfServiceDescription.xml... (TaskId:33) 1>Done executing task "DeploymentFramework.BuildTasks.PublishWcfServiceArtifacts". (TaskId:33) 1>Done building target "AfterBuild" in project "*.InvoiceHub.IIS.csproj".: (TargetId:67)

Notice that on my local machine the Task Parameter is written to the log prior to the line "Exporting WCF service artifacts from WcfServiceDescription.xml...", but not on the build server.

I'm using V6.0

Any help on where to start troubleshooting would be great!

This work item was migrated from CodePlex

CodePlex work item ID: '11124' Vote count: '1'

tfabraham commented 6 years ago

[tfabraham@10/14/2016] The first thing the task does is attempt to load types from the assembly Microsoft.BizTalk.Adapter.Wcf.Publishing, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. The first thing you can do is verify the existence of that specific DLL version in the GAC on the TFS server.

Thanks, Tom

tfabraham commented 6 years ago

[HakTho@10/17/2016] Thank you for the quick response, much appreciated!

The specific assembly is present in the GAC on the build machine. Is there any way to get more logging? I have set the build logging verbosity to "Diagnostic" already. Is the fact that the Task Parameter is not written to the log any clue to what may be wrong?

// HakTho

tfabraham commented 6 years ago

[tfabraham@10/17/2016] OK. The simplest way to diagnose it is by adding the task code to a .NET console app that you can run on the build server. You'll find the code here:

http://biztalkdeployment.codeplex.com/SourceControl/latest#Dev/V6_0/Tools/BuildTasks/BizTalkDeploymentFramework.Tasks/PublishWcfServiceArtifacts.cs

You can add the whole class if you add the MSBuild references, or you can just take the Execute() method code and give it the parameters it normally gets from the properties.

The exception you're seeing is coming from a reflection-based method invocation from the line pwmtMethod.Invoke(null, new object[] { wsi, type });

Let me know if you can pull out any more exception detail that way.

tfabraham commented 6 years ago

[HakTho@11/16/2016] Thank you for answering so quickly. Unfortunately I haven’t had access to the build server until now. Running the Execute() method threw the same System.Reflection.TargetInvocationException but now I was able to read the inner exception:

 [System.IO.FileNotFoundException]
{"Could not load file or assembly 'file:///C:\\WINDOWS\\Microsoft.Net\\assembly\\GAC_MSIL\\AISPASE.InvoiceHub.Schemas.Tieto\\v4.0_1.0.0.0__0b7fb4577b192af1\\AISPASE.InvoiceHub.Schemas.Tieto.dll' or one of its dependencies. }

This is the assembly containing the WcfMessageType specified in the WcfServiceDescription.xml created when manually publishing the service using the BizTalk WCF Service Publishing Wizard.

<WcfMessageType Category="XsdType" TypeName="AISPASE.InvoiceHub.Schemas.Tieto.TEAPPSXMLv272_schema_INVOICES" AssemblyName="AISPASE.InvoiceHub.Schemas.Tieto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0b7fb4577b192af1" AssemblyLocation="C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\AISPASE.InvoiceHub.Schemas.Tieto\v4.0_1.0.0.0__0b7fb4577b192af1\AISPASE.InvoiceHub.Schemas.Tieto.dll" RootName="INVOICE_CENTER" IsAnyType="false" IsEnvelope="false" />

This assembly is of course not in the GAC of the build server.

When using the wizard, I did not specify the assembly in the GAC, but rather the actual dll in the schema project output folder, but it seems that the wizard chose the GAC location as the assembly actually is present in the GAC on my development machine. What is the best approach to solve this? Would it be to manually edit the WcfServiceDescription.xml and specify a different location for the assembly?

// HakTho