Broken after NugetPackage update, Microsoft.AspnetCore.* and Microsoft.Extensions.*

When I tried with all packages on the list, still have the same issue.
Is there any known issue with duplicate package issue?
and “Microsoft.Extensions.Configuration.Json” is version 5.x, not the 2.x does it matter?
and when you mention " latest ASP.NET Core dependencies"
does it mean target platform? or Microsoft.AspNetCore?

Did you try it with only those 2.* package references? Because replacing the package references of your example to the latest wildcard 2.x versions worked for us.

Microsoft have stopped providing support for ASP.NET Core on .NET Framework at 2.1 LTS, I wouldn’t use anything other than the ASP .NET Core 2.x packages that is supported to run on .NET Framework since Microsoft has explicitly stated that ASP .NET Core 3+ would only run on .NET Core and would not be compatible with .NET Framework.

I’ve also tested your test with .NET Core which also works without issue. As .NET Core supports a .NET Framework compatibility mode which supports referencing some .NET Framework .dll’s in .NET Core projects, converting your project to run on .NET 5 may also be a solution you may want to consider.

@mythz
Some projects are .NET standard and binding with .NET Framework, so cannot change from standard to .NET 5.
when it was 3.x like the screen shot, it was fine. but when it updated to 5.x, it’s broken.
any idea about targetframework for .NET standard 2.0?

.NET Core can reference .NET Framework references through the .NET Framework compatibility layer I linked to, won’t know if it supports your .NET FX references unless you try.

Then that sounds like the cause of the issue.

I was never was able to make it work. I converted the entire code base to .NET 5.0, and I still got the same exception. I looked inside the .csproj for the PackageReferences so I could change their version reference to 2., but they no longer contain the Microsoft library explicitly:

  <ItemGroup>
    <PackageReference Include="DistributedLock" Version="2.0.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
    <PackageReference Include="NLog" Version="4.7.9" />
    <PackageReference Include="NLog.Extensions.Logging" Version="1.7.2" />
    <PackageReference Include="ServiceStack" Version="5.11.0" />
    <PackageReference Include="ServiceStack.Kestrel" Version="5.11.0" />
    <PackageReference Include="ServiceStack.OrmLite.SqlServer" Version="5.11.0" />
  </ItemGroup>

Do I need to add the Microsoft.* package references explicitly? And do I need to use the *.Core versions of the ServiceStack packages if the app and all the dependencies are .NET 5.0?

I checked out the samples in https://docs.servicestack.net/netcore but there aren’t any samples specifically for a Windows Service hosting a ServiceStack API. Does such an animal exist?

Another oddity. If I create an AppHost inherited from AppSelfHostBase, then I get the exception as stated. However, if I use AppHostBase or GenericAppHost instead, they don’t support the Start() method. I can get the code to compile, but when I run it, it says the Start() method is not supported for this type.

You only need references to packages you use, you don’t need to include ServiceStack’s dependencies. Try removing all dependencies except for ServiceStack then only include the ones needed for your App to compile.

Can you publish a small standalone .NET 5 project with the issue to GitHub and post the link to it here?