PostSharp assembly error upgrading Delinea Secret Server

The Problem

Today I was upgrading our self hosted Delinea Secret Server from 11.9.x to 12.0.x. These upgrades are usually an easy process, all achieved within the Secret Server web UI, but not today.

The upgrade proceeded as normal, downloading the new package, updating the DB schema and updating the binaries, but then it stopped. It did not move onto the next step.

The Analysis

I remoted onto our Windows server hosting our Secret Server instance and via Internet Information Service Manager launched the Secret Server instance via the URL http://localhost. This showed the error

Exception message: Could not load file or assembly ‘PostSharp, Version=2023.0.8.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Of course I could also have seen this error in the server’s Windows Logs > Application event log.

The Solution

I suspected that the issue was some historical .NET binding redirect in the C:\inetpub\SecretServer\web.config file, and this proved to be true.

I checked to see the version of the PostSharp.dll file in C:\inetpub\SecretServer\bin folder, it was 24.1.9.0 not 2023.0.8.0.

So, I edited the C:\inetpub\SecretServer\web.config file to update the redirects from

<dependentAssembly>
  <assemblyIdentity name="PostSharp" publicKeyToken="b13fd38b8f9c99d7" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-2023.0.8.0" newVersion="2023.0.8.0" />
</dependentAssembly>

to

<dependentAssembly>
  <assemblyIdentity name="PostSharp" publicKeyToken="b13fd38b8f9c99d7" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-2024.1.9.0" newVersion="2024.1.9.0" />
</dependentAssembly>

I then just browsed again to the Secret Server again and it loaded as expected.

Summing up

I am not sure if this issue was due to a problem in the new Secret Server package, or due to debris specific to our server. Luckily as the issue appeared during the site reload, and not the acutal upgrade process, there was no real damage done.

For the original version of this post see Richard Fennell's personal blog at PostSharp assembly error upgrading Delinea Secret Server