-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transitive nuget dependencies are not handled with netstandard libraries #3949
Comments
msbuild does not resolve it so it's never given to |
Well then it's an msbuild issue apparently. This "should" work I believe. @jstedfast @radical ? |
Any update on this issue?
|
@chances - I believe that is the best work around until this is sorted out. There is no update currently. |
So after some investigation (for a developer community issue), it seems this is kind of the expected behavior: dependencies of .netstandard projects don't flow to the referencing ("old-style") project. This behavior is explained in dotnet/sdk#901. The fix seems to be to migrate your main project to a PackageReference project, which is fairly simple: https://stackoverflow.com/a/49266856/183422. For extensions, this also needs an additional fix (the fix for #4237), which should be released to stable together with our iOS 12 supported release fairly soon. Leaving open so that we can write tests (can't do it quite yet, since we need to build/test with msbuild, which requires 2018-06 to get a version that supports our needs). |
This fixes a build problem where the iOS project isn't passed the reference to the referenced .NET Standard project's nuget reference, and the linker ends up complaining that it can't find the NuGet: MTOUCH : error MT2001: Could not link assemblies. Reason: Error while processing references of 'TodoRESTiOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' [/xamarin-forms-samples/WebServices/TodoREST/iOS/TodoREST.iOS.csproj] --- inner exception (TaskId:143) Mono.Linker.LoadException: Error while processing references of 'TodoRESTiOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' (TaskId:143) Reference: xamarin/xamarin-macios#3949
This fixes a build problem where the iOS project isn't passed the reference to the referenced .NET Standard project's nuget reference, and the linker ends up complaining that it can't find the NuGet: MTOUCH : error MT2001: Could not link assemblies. Reason: Error while processing references of 'TodoRESTiOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' [/xamarin-forms-samples/WebServices/TodoREST/iOS/TodoREST.iOS.csproj] --- inner exception (TaskId:143) Mono.Linker.LoadException: Error while processing references of 'TodoRESTiOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' (TaskId:143) Reference: xamarin/xamarin-macios#3949
So I'm still seeing this problem on resolving native libraries inside nugets. In this example: I have two projects:
NetLib has a reference to Microsoft.CognitiveServices.Speech nuget. If the XI project does not, it incorrectly resolves: ~/.nuget/packages/microsoft.cognitiveservices.speech/1.13.0/runtimes/win-x64/native/Microsoft.CognitiveServices.Speech.core.dll NOT ~/.nuget/packages/microsoft.cognitiveservices.speech/1.13.0//build/Xamarin.iOS/libMicrosoft.CognitiveServices.Speech.core.a Once I add the nuget to the main XI project, it starts working. |
This is solved in .NET. |
A netstandard library that depends on nuget libraries will not be correctly resolved unless the XM or XI library in question also resolves those libraries independently.
Steps to Reproduce
Expected Behavior
The XI and XM library to resolve the nuget required by the netstd library.
Actual Behavior
The "transitive" dependency of a dependency is not resolved correctly.
Environment
https://gist.github.com/chamons/a1fb655991f9bb749168b406e7544cce
Build Logs
https://gist.github.com/chamons/f66954a712614afa70058b63e909041a
Example Project (If Possible)
The text was updated successfully, but these errors were encountered: