Currently, I am creating an Azure DevOps build for my service fabric application. On my local machine the build, package and publish steps work like expected.
But when I run the template Azure service fabric build on Azure DevOps the output generated is incorrect. The service package does not contain my .exe
in the code folder instead the folder contains the root folder of my .sfproj
.
In the build and package step of the .sfproj
output I can see the service getting build.
The current build looks like this:
- Use NuGet
- NuGet restore
- Build .sln
- Build .sfproj
- copy files pdbs
- Delete files *.pdbs
- Update service fabric manifest
- Copy build files
- Publish artifact
The things I already tried:
- Implement the service fabric template build on DevOps.
- Tried following a few tutorials on the internet.
- Tried to make sense of what is happening and how it is happening.
- Tried running a local PowerShell build (maybe something was wrong with my files), this build succeeded with the correct output.
The output I expect from the build:
>D:\TEMP\MYAPPLICATIONTYPE
>>ApplicationManifest.xml
>>>MyServiceManifest
>>>>ServiceManifest.xml
>>>MyCode
>>>> - MyServiceHost.exe
>>>MyConfig
>>>> - Settings.xml
>>>MyData
>>>> - init.dat'
The output I get from the build:
>D:\TEMP\MYAPPLICATIONTYPE
>>ApplicationManifest.xml
>>>MyServiceManifest
>>>>ServiceManifest.xml
>>>MyCode
>>>> - ApplicationPackageRoot
- ApplicationParameters
- obj
- PublishProfiles
- Scripts
- Packages.config
- ServiceFabricApplication.sfproj
- ServiceFabricApplication.sfproj.log
>>>MyConfig
>>>> - Settings.xml
>>>MyData
>>>> - init.dat'
In the release step the following error occurs that does not occur in a local publish:
`2019-04-08T14:31:51.9203463Z Service fabric SDK version: 2.4.164.9494.
2019-04-08T14:31:52.4143574Z ##[debug]INPUT_USEDIFFPACKAGE: 'false'
2019-04-08T14:31:52.5363270Z ##[debug]MAILPROCESSINGSERVICE_INSTANCECOUNT (empty)
2019-04-08T14:31:52.5383524Z ##[debug]INPUT_OVERWRITEBEHAVIOR: 'SameAppTypeAndVersion'
2019-04-08T14:31:53.5679860Z ##[debug]Join-Path "C:\Program Files\Microsoft Service Fabric\bin\fabric\fabric.code" "ServiceFabricServiceModel.xsd"
2019-04-08T14:31:53.5726035Z ##[debug]C:\Program Files\Microsoft Service Fabric\bin\fabric\fabric.code\ServiceFabricServiceModel.xsd
2019-04-08T14:31:53.5738046Z ##[debug]Length: 94
2019-04-08T14:31:53.5757439Z ##[debug]
2019-04-08T14:31:53.5780120Z ##[debug]Test-Path "C:\Program Files\Microsoft Service Fabric\bin\fabric\fabric.code\ServiceFabricServiceModel.xsd"
2019-04-08T14:31:53.5819217Z ##[debug]True
2019-04-08T14:31:53.5832941Z ##[debug]
2019-04-08T14:31:55.9628794Z ##[debug]System.Fabric.Management.ImageBuilder.FabricImageBuilderValidationException: Exception while parsing XML file: C:\Users\VssAdministrator\AppData\Local\Temp\TestApplicationPackage_31174153637\r5wofi1j.xyh\applicationpackage\ApplicationManifest.xml
2019-04-08T14:31:55.9641825Z ##[debug]FileName: C:\Users\VssAdministrator\AppData\Local\Temp\TestApplicationPackage_31174153637\r5wofi1j.xyh\applicationpackage\ApplicationManifest.xml ---> System.InvalidOperationException: There is an error in XML document (2, 254). ---> System.Xml.Schema.XmlSchemaValidationException: The 'ManifestId' attribute is not declared.
2019-04-08T14:31:55.9655413Z ##[debug] at System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(XmlSchemaValidationException e, XmlSeverityType severity)
2019-04-08T14:31:55.9668097Z ##[debug] at System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(String code, String arg)
2019-04-08T14:31:55.9680818Z ##[debug] at System.Xml.Schema.XmlSchemaValidator.ValidateAttribute(String lName, String ns, XmlValueGetter attributeValueGetter, String attributeStringValue, XmlSchemaInfo schemaInfo)
2019-04-08T14:31:55.9694803Z ##[debug] at System.Xml.XsdValidatingReader.ValidateAttributes()
2019-04-08T14:31:55.9707640Z ##[debug] at System.Xml.XsdValidatingReader.ProcessElementEvent()
2019-04-08T14:31:55.9846731Z ##[debug] at System.Xml.XsdValidatingReader.Read()
2019-04-08T14:31:55.9860420Z ##[debug] at System.Xml.XmlReader.MoveToContent()
2019-04-08T14:31:55.9876589Z ##[debug] at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read395_ApplicationManifest()
2019-04-08T14:31:55.9889383Z ##[debug] --- End of inner exception stack trace ---
2019-04-08T14:31:55.9903452Z ##[debug] at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
2019-04-08T14:31:55.9919035Z ##[debug] at System.Fabric.Management.ImageBuilder.ImageBuilderUtility.ReadXml[T](String fileName, XmlReader reader)
2019-04-08T14:31:55.9936054Z ##[debug] --- End of inner exception stack trace ---
2019-04-08T14:31:55.9945480Z ##[debug] at System.Fabric.Management.ImageBuilder.ImageBuilderUtility.TraceAndThrowValidationErrorWithFileName(Exception innerException, String type, String fileName, String format, Object[] args)
2019-04-08T14:31:55.9958172Z ##[debug] at System.Fabric.Management.ImageBuilder.ImageBuilderUtility.ReadXml[T](String fileName, XmlReader reader)
2019-04-08T14:31:55.9971320Z ##[debug] at System.Fabric.Management.ImageBuilder.ImageBuilderUtility.ReadXml[T](String fileName, XmlReaderSettings validatingXmlReaderSettings)
2019-04-08T14:31:55.9984222Z ##[debug] at System.Fabric.Management.ImageBuilder.ApplicationProvisionOperation.<ParseApplicationPackageAsync>d__8.MoveNext()
2019-04-08T14:31:55.9996678Z ##[debug]--- End of stack trace from previous location where exception was thrown ---
2019-04-08T14:31:56.0009376Z ##[debug] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2019-04-08T14:31:56.0022409Z ##[debug] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2019-04-08T14:31:56.0035985Z ##[debug] at System.Fabric.Management.ImageBuilder.ApplicationProvisionOperation.<ProvisionApplicationAsync>d__0.MoveNext()
2019-04-08T14:31:57.8717259Z ##[debug]SYSTEM_JOBID: '7541fd7f-879e-4baf-a7a6-9e527906c514'
2019-04-08T14:31:58.3025935Z ##[debug]Processed: ##vso[telemetry.publish area=TaskHub;feature=ServiceFabricDeploy]{"OperationId":"TestApplicationPackage","ExceptionData":"System.Fabric.Management.ImageBuilder.FabricImageBuilderValidationException;System.InvalidOperationException;System.Xml.Schema.XmlSchemaValidationException;|D:\\a\\_tasks\\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\\1.7.31\\ServiceFabricSDK\\Publish-NewServiceFabricApplication.ps1|243","JobId":"7541fd7f-879e-4baf-a7a6-9e527906c514","SDKVersion":"2.4.164.9494"}
2019-04-08T14:31:58.8521847Z ##[debug]Leaving D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.31\deploy.ps1.
2019-04-08T14:31:58.8569063Z ##[debug]Caught exception from task script.
2019-04-08T14:31:58.8613132Z ##[debug]Error record:
2019-04-08T14:31:58.9458146Z ##[debug]Test-ServiceFabricApplicationPackage : Exception while parsing XML file: C:\Users\VssAdministrator\AppData\Local\Temp\TestApplicationPackage_31174153637\r5wofi1j.xyh\applicationpackage\ApplicationManifest.xml
2019-04-08T14:31:58.9475003Z ##[debug]FileName: C:\Users\VssAdministrator\AppData\Local\Temp\TestApplicationPackage_31174153637\r5wofi1j.xyh\applicationpackage\ApplicationManifest.xml
2019-04-08T14:31:58.9487449Z ##[debug]At D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.31\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:243 char:46
2019-04-08T14:31:58.9501612Z ##[debug]+ ... tionSuccess = (Test-ServiceFabricApplicationPackage $AppPkgPathToUse)
2019-04-08T14:31:58.9516184Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-04-08T14:31:58.9544781Z ##[debug] + CategoryInfo : InvalidOperation: (:) [Test-ServiceFabricApplica tionPackage], FabricImageBuilderValidationException
2019-04-08T14:31:58.9559184Z ##[debug] + FullyQualifiedErrorId : TestApplicationPackageErrorId,Microsoft.ServiceF abric.Powershell.TestApplicationPackage
2019-04-08T14:31:58.9575586Z ##[debug]
2019-04-08T14:31:58.9596675Z ##[debug]Script stack trace:
2019-04-08T14:31:58.9642005Z ##[debug]at Publish-NewServiceFabricApplication, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.31\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1: line 243
2019-04-08T14:31:58.9655696Z ##[debug]at <ScriptBlock>, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.31\deploy.ps1: line 194
2019-04-08T14:31:58.9674225Z ##[debug]at <ScriptBlock>, <No file>: line 1
2019-04-08T14:31:58.9687438Z ##[debug]at <ScriptBlock>, <No file>: line 22
2019-04-08T14:31:58.9713344Z ##[debug]at <ScriptBlock>, <No file>: line 18
2019-04-08T14:31:58.9723271Z ##[debug]at <ScriptBlock>, <No file>: line 1
2019-04-08T14:31:58.9745709Z ##[debug]Exception:
2019-04-08T14:31:58.9793977Z ##[debug]System.Fabric.Management.ImageBuilder.FabricImageBuilderValidationException: Exception while parsing XML file: C:\Users\VssAdministrator\AppData\Local\Temp\TestApplicationPackage_31174153637\r5wofi1j.xyh\applicationpackage\ApplicationManifest.xml
2019-04-08T14:31:58.9805388Z ##[debug]FileName: C:\Users\VssAdministrator\AppData\Local\Temp\TestApplicationPackage_31174153637\r5wofi1j.xyh\applicationpackage\ApplicationManifest.xml ---> System.InvalidOperationException: There is an error in XML document (2, 254). ---> System.Xml.Schema.XmlSchemaValidationException: The 'ManifestId' attribute is not declared.
2019-04-08T14:31:58.9818107Z ##[debug] at System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(XmlSchemaValidationException e, XmlSeverityType severity)
2019-04-08T14:31:58.9829274Z ##[debug] at System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(String code, String arg)
2019-04-08T14:31:58.9840639Z ##[debug] at System.Xml.Schema.XmlSchemaValidator.ValidateAttribute(String lName, String ns, XmlValueGetter attributeValueGetter, String attributeStringValue, XmlSchemaInfo schemaInfo)
2019-04-08T14:31:58.9851940Z ##[debug] at System.Xml.XsdValidatingReader.ValidateAttributes()
2019-04-08T14:31:58.9863424Z ##[debug] at System.Xml.XsdValidatingReader.ProcessElementEvent()
2019-04-08T14:31:58.9877769Z ##[debug] at System.Xml.XsdValidatingReader.Read()
2019-04-08T14:31:58.9891850Z ##[debug] at System.Xml.XmlReader.MoveToContent()
2019-04-08T14:31:58.9906079Z ##[debug] at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read395_ApplicationManifest()
2019-04-08T14:31:58.9917176Z ##[debug] --- End of inner exception stack trace ---
2019-04-08T14:31:58.9928302Z ##[debug] at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
2019-04-08T14:31:58.9939501Z ##[debug] at System.Fabric.Management.ImageBuilder.ImageBuilderUtility.ReadXml[T](String fileName, XmlReader reader)
2019-04-08T14:31:58.9950819Z ##[debug] --- End of inner exception stack trace ---
2019-04-08T14:31:58.9962116Z ##[debug] at System.Fabric.Management.ImageBuilder.ImageBuilderUtility.TraceAndThrowValidationErrorWithFileName(Exception innerException, String type, String fileName, String format, Object[] args)
2019-04-08T14:31:58.9973510Z ##[debug] at System.Fabric.Management.ImageBuilder.ImageBuilderUtility.ReadXml[T](String fileName, XmlReader reader)
2019-04-08T14:31:58.9984837Z ##[debug] at System.Fabric.Management.ImageBuilder.ImageBuilderUtility.ReadXml[T](String fileName, XmlReaderSettings validatingXmlReaderSettings)
2019-04-08T14:31:58.9998358Z ##[debug] at System.Fabric.Management.ImageBuilder.ApplicationProvisionOperation.<ParseApplicationPackageAsync>d__8.MoveNext()
2019-04-08T14:31:59.0007662Z ##[debug]--- End of stack trace from previous location where exception was thrown ---
2019-04-08T14:31:59.0020745Z ##[debug] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2019-04-08T14:31:59.0032029Z ##[debug] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2019-04-08T14:31:59.0045270Z ##[debug] at System.Fabric.Management.ImageBuilder.ApplicationProvisionOperation.<ProvisionApplicationAsync>d__0.MoveNext()
2019-04-08T14:31:59.0363118Z ##[error]Exception while parsing XML file: C:\Users\VssAdministrator\AppData\Local\Temp\TestApplicationPackage_31174153637\r5wofi1j.xyh\applicationpackage\ApplicationManifest.xml
FileName: C:\Users\VssAdministrator\AppData\Local\Temp\TestApplicationPackage_31174153637\r5wofi1j.xyh\applicationpackage\ApplicationManifest.xml
2019-04-08T14:31:59.0371868Z ##[debug]Processed: ##vso[task.logissue type=error]Exception while parsing XML file: C:\Users\VssAdministrator\AppData\Local\Temp\TestApplicationPackage_31174153637\r5wofi1j.xyh\applicationpackage\ApplicationManifest.xml%0D%0AFileName: C:\Users\VssAdministrator\AppData\Local\Temp\TestApplicationPackage_31174153637\r5wofi1j.xyh\applicationpackage\ApplicationManifest.xml
2019-04-08T14:31:59.0373492Z ##[debug]Processed: ##vso[task.complete result=Failed]`
MSBuild Arguments
do you use to build.sfproj
and.sln
? – SteppingRazor.sln
the following arguments are used:/p:RunInBuild=true
For the.sfproj
the following arguments are used:/t:Package /p:PackageLocation=$(build.artifactstagingdirectory)\Application\applicationpackage
– leroy hermans