В настоящее время я создаю сборку Azure DevOps для своего приложения фабричной службы. На моей локальной машине шаги сборки, упаковки и публикации работают, как и ожидалось.
Но когда я запускаю шаблон сборки Azure Service Fabric в Azure DevOps, сгенерированный вывод неверен. Пакет услуг не содержит мой .exe
в папке с кодом, вместо этого папка содержит корневую папку моего .sfproj
.
На шаге сборки и пакета вывода .sfproj
я вижу, как сервис получает сборку.
Текущая сборка выглядит так:
- Используйте NuGet
- Восстановление NuGet
- Сборка .sln
- Сборка .sfproj
- скопировать файлы pdbs
- Удалить файлы * .pdbs
- Обновление сервисного манифеста ткани
- Скопируйте файлы сборки
- Опубликовать артефакт
Вещи, которые я уже пробовал:
- Реализация шаблона сервисной структуры на DevOps.
- Попробовал следовать нескольким учебникам в Интернете.
- Пытался понять, что происходит и как это происходит.
- Попытка запустить локальную сборку PowerShell (возможно, что-то не так с моими файлами), эта сборка завершилась с правильным выводом.
Вывод, который я ожидаю от сборки:
>D:\TEMP\MYAPPLICATIONTYPE
>>ApplicationManifest.xml
>>>MyServiceManifest
>>>>ServiceManifest.xml
>>>MyCode
>>>> - MyServiceHost.exe
>>>MyConfig
>>>> - Settings.xml
>>>MyData
>>>> - init.dat'
Вывод, который я получаю из сборки:
>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'
На этапе выпуска возникает следующая ошибка, которая не возникает при локальной публикации:
`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]`