Paul
Paul

Reputation: 3283

Cannot upgrade Service Fabric service due to "'MYAPPLICATION.ServiceFabricPkg' has changed" even though it hasn't changed

I have incremented the version of one of the services in my Service Fabric application.

However, when I try to upgrade the cluster I get the error below:

The content in CodePackage Name:Code and Version:1.0.0 in Service Manifest 
3>'MYAPPLICATION.ServiceFabricPkg' has changed, but the version number is the same.
3>At C:\Program Files\Microsoft SDKs\Service 
3>Fabric\Tools\PSModule\ServiceFabricSDK\Publish-UpgradedServiceFabricApplication.ps1:135 char:38

This is a huge issue for me as one of the best selling points of Service Fabric is being able update one service without touching others.

Does anyone know a solution for this?

Research points to the error being related to compression, so I added

<CopyPackageParameters CompressPackage="false" />

to my Local5Node.xml file.

This makes no difference.

I am trying to do this via publish with Visual Studio 2017.

Cheers

Paul

Upvotes: 0

Views: 1255

Answers (2)

Oleg Karasik
Oleg Karasik

Reputation: 969

I think you can have a problem when you have updated the service code, updated code version in the ServiceManifest.xml but haven't updated the application version in ApplicationManifest.xml.

Here are examples if you are updating you service from version 1.0.0 to 1.1.0.

Manual Approach

In ServiceManifest.xml

  1. Update version of code package.
<CodePackage Name="Code" Version="1.1.0" />
  1. Update version of service manifest.
<ServiceManifest Name="ServicePkg" Version="1.1.0" />

In ApplicationManifest.xml

  1. Update version of service manifest reference.
<ServiceManifestImport>
  <ServiceManifestRef ServiceManifestName="ServicePkg" ServiceManifestVersion="1.1.0" />
  <ConfigOverrides />
</ServiceManifestImport>
  1. Update version of application type
<ApplicationManifest ApplicationTypeName="AppType" ApplicationTypeVersion="1.1.0" />

Visual Studio Approach

  1. Select Service Fabric Application project and Right Click on in
  2. Choose 'Edit Manifest Versions...'
  3. Check 'Automatically update application and service versions'
  4. Change version of 'Code' in service you like.

Hope this helps.

Upvotes: 0

Diego Mendes
Diego Mendes

Reputation: 11351

This happens because you have updated the service binaries and didn't update the manifests with a new version number, the manifest points to the same version as before but the binaries are different.

Service fabric use the manifest versions to identify which services should be updated during an application upgrade, because you didn't set the new versions and the binaries has changed, it will rollback to avoid issues.

A quick search about this error return a few results with the reason for this, please take a look on these answers:

Error while upgrading Azure Service Fabric through VSTS CI/CD

Deployment for Service Fabric service version upgrade fails on VSTS Release

Differential packaging

Upvotes: 1

Related Questions