2

ServiceStack Old Version: 3.9.71 ServiceStack New version: 5.9.2 .Net Framework: 4.6.1

We are facing quite a few issues while trying to upgrade ServiceStack. Could someone please help. The predominant issue is as below: CS0012 The type 'IDbConnectionFactory' is defined in an assembly that is not referenced. You must add a reference to assembly 'ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

We tried a number of methods suggested online, but were not successful. The following the methods that were already tried: a. We uninstalled all instances of the older version and removed from Debug folder and installed the new version. b. Cleaned the solution and restarted the Visual Studio after the installation.

1 Answers1

1

The error suggests that your project is not referencing ServiceStack.Interfaces.dll from the ServiceStack.Interfaces NuGet package.

As this error appears to be a binary incompatible issue I'd recommend you individually re-add the NuGet packages so they are all referencing the same version of ServiceStack and that all your projects have project references to each other so that a full rebuild rebuilds all your projects and is not referencing and old compiled binary of your project referencing an incompatible version.

I would also recommend your project uses the new MS Build project format which has more human readable references so it's clear that all references to ServiceStack are NuGet <PackageReference/> and reference the same version.

  <ItemGroup>
    <PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
    <PackageReference Include="ServiceStack" Version="5.9.2" />
    <PackageReference Include="ServiceStack.Server" Version="5.9.2" />
  </ItemGroup>

If it helps, you can view the source code of ServiceStack's .NET Framework Project Templates to compare against your own.

https://github.com/NetFrameworkTemplates/web-netfx

mythz
  • 141,670
  • 29
  • 246
  • 390