reinforced / Reinforced.Typings

Converts C# classes to TypeScript interfaces (and many more) within project build. 0-dependency, minimal, gluten-free

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RT0999: Could not load file or assembly 'System.ServiceModel.Primitives' with NET Standard 2.0

vmcbaptista opened this issue · comments

I have a .NET Standard 2.0 project, <Project Sdk="Microsoft.NET.Sdk">

referencing the following nuget
<PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" />

I'm getting the following error during build
1>Reinforced.Typings : Unexpected error RT0999: Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.8.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

The same happens if I retarget the project to .net core or .net 5.

If I retarget the project to .net framework, build runs fine

Any updates here? I have the same problem with .net 5

@vmcbaptista @Crossfire92 Did either of you figure out what the cause was, or a workaround?

I'm also interested, we have this now in a .net 8 project when adding <RtAdditionalAssembly> to a project referencing System.ServiceModel.Primitives

1>Reinforced.Typings: Warning RT0014 Assembly loading: Assembly System.ServiceModel.Primitives (from C:\Users\xxx.nuget\packages\system.servicemodel.primitives\6.2.0\ref\net6.0\System.ServiceModel.Primitives.dll) failed to load: System.BadImageFormatException: Could not load file or assembly 'System.ServiceModel.Primitives, Version=6.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL'. Reference assemblies cannot be loaded for execution. (0x80131058)

Fixed in previous PR, turns out there are so called "Reference Assemblies" which are stripped-down versions of the actual implementation assemblies, and some nuget packages ship them in their /ref/ folders.
And also ship the corresponding real assembly in the /lib/.

My solution was to use the normal assembly where it could be found simply, or drop the ref assembly where not.

When building my .NET8 project, there were 311 reference assemblies (listed in the .tmp file), only 1 of them caused problems, and only 10 of them could be replaced by its implementation assembly.