Nidhi
Nidhi

Reputation: 774

TypeLoadException : Could not resolve type (from typeref, class/assembly System.IO.Stream, System.Runtime, Version=4.2.2.0, Culture=neutral)

TypeLoadException : Could not resolve type with token xx (from typeref, class/assembly System.IO.Stream, System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=xx)

I am new with c# and Unity

I have created dll using Visual Studio using .Net Core 3.1

Using the dll in Unity (using .Net 4.x)

I can run normal code successfully. But, While using GetResponseStream() in code of dll, I get this error in Unity.

Are the versions used in my library project and Unity project compatible? How can I successfully use Stream reading code or in my c# project?

I am just copying dll in Unity project, do I need to copy something else too?

Upvotes: 1

Views: 3152

Answers (1)

raybarrera
raybarrera

Reputation: 170

You'll want to recompile your code as a .NET Framework 4.x DLL instead of a .NET core 3.1 DLL. Unity does not support the .NET Core profile.

Technically, .NET Standard 2.0 is also supported depending on which Unity version you're targeting, but it's deprecated/removed in more recent versions.

For reference: https://docs.unity3d.com/2019.1/Documentation/Manual/dotnetProfileSupport.html

Upvotes: 2

Related Questions