ArxOne / MrAdvice

.NET aspect weaver (build task under NuGet package)
MIT License
311 stars 45 forks source link

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

Closed Alex-Dobrynin closed 1 year ago

Alex-Dobrynin commented 3 years ago

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

picrap commented 3 years ago

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

Alex-Dobrynin commented 2 years ago

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

picrap commented 2 years ago

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

Alex-Dobrynin commented 2 years ago

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 commented 2 years ago

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

picrap commented 2 years ago

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

picrap commented 2 years ago

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.

Alex-Dobrynin commented 2 years ago

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

picrap commented 2 years ago

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

Alex-Dobrynin commented 2 years ago

just random screenshot from nuget image

picrap commented 2 years ago

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

Alex-Dobrynin commented 2 years ago

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

picrap commented 2 years ago

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 😉

Alex-Dobrynin commented 2 years ago

.net5 is not supported by xamarin forms

picrap commented 2 years ago

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

Alex-Dobrynin commented 2 years ago

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

picrap commented 2 years ago

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

Alex-Dobrynin commented 2 years ago

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 commented 1 year ago

Found the problem, you need to add this

netstandard2.0

here

image

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

picrap commented 1 year ago

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