Blazor wasm clash with ServiceStack.Script

The ServiceStack documentation states DTOs should be logic and dependency-free so the only dependency the ServiceModel project references is the impl-free ServiceStack.Interfaces.dll which as it’s a .NET v4.5 and .NET Standard 2.0 .dll, can be freely referenced from all .NET Mobile and Desktop platforms.

However, if I want to [AutoApply] attributes for auditing my request DTOs I need a dependency on ServiceStack.dll to use #Script methods (i.e. using ServiceStack.Script)

For my Vue/TypeScript applications this has not caused any issues and worked well.

I am now moving to Blazor Wasm, and the reference to ServiceStack.dll is causing a framework target conflict:

Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(427, 5): [NETSDK1082] There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.

Using the advice from, I have identified that the problem as being in the ServiceModel.csproj:

<PackageReference Include="ServiceStack" Version="6.*" />

This is causing Microsoft.AspNetCore.App to be referenced, which trigers the NETSDK1082 error


  "ServiceStack/6.0.3": {
    "type": "package",
    "dependencies": {
      "ServiceStack.Client": "6.0.3",
      "ServiceStack.Common": "6.0.3",
      "ServiceStack.Interfaces": "6.0.3",
      "ServiceStack.Text": "6.0.3",
      "System.Drawing.Common": "5.0.2"
    "compile": {
      "lib/net6.0/ServiceStack.dll": {}
    "runtime": {
      "lib/net6.0/ServiceStack.dll": {}
    "frameworkReferences": [

So, any ideas how I can proceed to use ServiceStack plus DTO auditing plus Wasm?

Correct your DTOs shouldn’t have any dependencies to ServiceStack.dll.

The [AutoApply] attribute is in ServiceStack.Interfaces like all DTO attributes. Can you provide the full DTOs forcing you to reference ServiceStack.dll?

Of course, you are completely correct. My inclusion of database related code into a general helper project was the cause of the dependency problem.

I had included my customised MyAuditScriptMethods,which depended on the ServiceStack.dll

using ServiceStack.Script;    

// Script extensions used in AutoPopulate of db's audit fields
public class MyAuditScriptMethods : ScriptMethods

with my customised MyAuditBase code, which only depended on the ServiceStack.Interfaces.dll.

Separating my customised MyAuditBase code from MyAuditScriptMethods, allowed my DTO’s to depend only on ServiceStack.Interfaces.dll.

public record UserSetting : MyAuditBase
    [DataMember, Required]
    public Guid Id { get; init; }

The above customisations were required, because of my special auditing requirements that are different from ServiceStack’s.

Thank for the weekend support.

PS: Anybody using Vue, and wanting a brilliant UI framework, checkout

1 Like