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.
https://docs.servicestack.net/service-complexity-and-dto-roles#data-transfer-objects-dtos
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)
https://docs.servicestack.net/autoquery-crud#advanced-crud-example
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 https://github.com/dotnet/aspnetcore/issues/36711, 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
ServiceModel/obj/project.assets.json:
"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": [
"Microsoft.AspNetCore.App"
]
},
So, any ideas how I can proceed to use ServiceStack plus DTO auditing plus Wasm?