MrAdvice icon indicating copy to clipboard operation
MrAdvice copied to clipboard

Failed to resolve assembly: System.Private.CoreLib, Version=5.0.0.0

Open Alex-Dobrynin opened this issue 4 years ago • 18 comments

After updating to version 2.9.2 I get this error Error Failed to resolve assembly: 'System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'

Xamarin.Forms 5, .netstandard2.1, c#9

Alex-Dobrynin avatar Sep 29 '21 10:09 Alex-Dobrynin

I don’t use Xamarin.Forms, could you provide a simple project with the problem?

picrap avatar Oct 01 '21 10:10 picrap

You shouldn't use xam.forms, but your lib references System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e which is .net core library. In xamarin forms .netstandard2.0 is used, so it is incompatible to use your lib from .netstandard2.0 or higher project

Alex-Dobrynin avatar Feb 15 '22 17:02 Alex-Dobrynin

We had problems with System.Private.CoreLib but this wasn’t related directly by the lib we use (dnlib). Could you provide a sample?

picrap avatar Feb 16 '22 08:02 picrap

It is very strange. In my test project it is working. but in my main project fails to compile. everything same, except few nuget packages. But if i downgrade your lib version to 2.8.12 it also works well. but upgrading to 2.9.x fails to compile. Something was broken in new version comparing to the old one

Alex-Dobrynin avatar Feb 16 '22 15:02 Alex-Dobrynin

OK, it is happens when upgrading from 2.8.12 to 2.9.0-test1. with 2.8.12 works well, with 2.9.0-test1 cannot compile.

Also, I cloned your repo and mentioned that there are no netstandard tests written

Alex-Dobrynin avatar Feb 16 '22 18:02 Alex-Dobrynin

We’ll give a try building for .net standard 2.0, then.

picrap avatar Feb 17 '22 08:02 picrap

That previous post was stupid: there is no way to build a weaver in .net standard because this not an actual framework. Could you tell me which weaver is used? If it is the net5/6 we could make a try by forcing the weaving with the .net 4.6.1 weaver.

picrap avatar Feb 18 '22 13:02 picrap

You probably have never created Xamarin projects. Core project is .netstandard2.x. and this is actualy a framework, because you can specify it as targetframework tag in .csproj file

Alex-Dobrynin avatar Feb 18 '22 14:02 Alex-Dobrynin

Instead of writing non-sense (.net standard is NOT a framowork, it’s a standard), could you tell which weaver is used? 😉

picrap avatar Feb 18 '22 14:02 picrap

just random screenshot from nuget image

Alex-Dobrynin avatar Feb 18 '22 14:02 Alex-Dobrynin

Could you tell which MrAdvice.Weaver.exe is used? (you still didn’t get it bout .net standard, but this is not the point)

picrap avatar Feb 18 '22 14:02 picrap

BlankApp1.zip here is sample project, there you can figure out, that core project is .netstandard project and it cannot be built using your latest lib. if you remove all mentions of your lib it can be built successfully. I don't know which MrAdvice.Weaver.exe is used, I just installing nuget package

Alex-Dobrynin avatar Feb 18 '22 15:02 Alex-Dobrynin

For your information on .net standard, please go read https://docs.microsoft.com/en-us/dotnet/standard/net-standard But thank you for the sample which says: MrAdvice 2.9.6/.NET 5.0 weaved module 'BlankApp1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' (targeting framework ) in 296ms So I guess this was the .net 5.0 weaver 😉

picrap avatar Feb 18 '22 15:02 picrap

.net5 is not supported by xamarin forms

Alex-Dobrynin avatar Feb 18 '22 15:02 Alex-Dobrynin

That’s why I’ll try to use the .NET 4.6.1 weaver

picrap avatar Feb 18 '22 15:02 picrap

.net framework also is not supported by xamarin. .net core 3.1 is supported

Alex-Dobrynin avatar Feb 18 '22 15:02 Alex-Dobrynin

MrAdvice.Weaver 2.8 was only built in .NET framework. And is working for your case.

picrap avatar Feb 18 '22 15:02 picrap

And it is strange. Could you provide .net core 3.1 version of your lib? or .netstandard2.0 For example, Prism library for xamarin forms provides their lib for .netstandard2.0 https://github.com/PrismLibrary/Prism/blob/master/src/Forms/Prism.Unity.Forms/Prism.Unity.Forms.csproj

Alex-Dobrynin avatar Feb 18 '22 15:02 Alex-Dobrynin

Found the problem, you need to add this

netstandard2.0

here

image

and it will work in netstandard libs, tested in my project locally

Alex-Dobrynin avatar Nov 05 '22 14:11 Alex-Dobrynin

https://www.nuget.org/packages/MrAdvice/2.9.9 Let me know!

picrap avatar Nov 05 '22 18:11 picrap