本文介绍了无法在Xamarin上加载System.Reflection.TypeExtensions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在某些Nuget软件包中使用System.Reflection.TypeExtensions.我希望此软件包可在Xamarin Forms项目中使用.根据 System.Reflection.TypeExtensions ,这应该适用于Xamarin.

I need to use System.Reflection.TypeExtensions in some of my Nuget packages. I want this package to be used within a Xamarin Forms project.According to the nuget package page of System.Reflection.TypeExtensions , this should work with Xamarin.

但是,当我出于测试目的编译我的Android项目时,出现此错误:

However, when I compile my Android project for testing purpose, I got this error :

加载程序集时发生异常:System.IO.FileNotFoundException:无法加载程序集'System.Reflection.TypeExtensions,版本= 4.0.1.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a'.也许在Mono for Android配置文件中不存在?

Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Reflection.TypeExtensions, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?

我无法弄清楚如何解决此错误,特别是因为其他无法删除的其他人需要此软件包...

I cannot figured it out how to fix this error, especially because this package is required by some other that I cannot remove...

有什么办法解决吗?

这是我的包中的project.json/frameworks:

Here my project.json/frameworks of my package :

"frameworks": {
"net45": {
  "frameworkAssemblies": {
    "System.Runtime": "",
    "System.ObjectModel": "",
    "System.Linq.Expressions": ""
  },
  "dependencies": {
    "System.Collections": "4.0.11-beta-23516"
  }
},
"dotnet5.2": {
  "dependencies": {
    "System.Collections": "4.0.10",
    "System.Collections.Concurrent": "4.0.11-beta-*",
    "System.ComponentModel": "4.0.1-beta-*",
    "System.Globalization": "4.0.11-beta-*",
    "System.Linq": "4.0.1-beta-*",
    "System.Linq.Expressions": "4.0.11-beta-*",
    "System.Reflection": "4.1.0-beta-*",
    "System.Reflection.Primitives": "4.0.1-beta-*",
    "System.Reflection.TypeExtensions": "4.0.1-beta-*",
    "System.Runtime": "4.0.21-beta-*",
    "System.Threading": "4.0.11-beta-*"
  }
},
"dnxcore50": {
  "dependencies": {
    "System.Collections": "4.0.11-beta-23516",
    "System.Collections.Concurrent": "4.0.11-beta-*",
    "System.ComponentModel": "4.0.1-beta-*",
    "System.Globalization": "4.0.11-beta-*",
    "System.Linq": "4.0.1-beta-*",
    "System.Linq.Expressions": "4.0.11-beta-*",
    "System.Reflection": "4.1.0-beta-*",
    "System.Reflection.Primitives": "4.0.1-beta-*",
    "System.Reflection.TypeExtensions": "4.1.0-beta-23516",
    "System.Runtime": "4.0.21-beta-*",
    "System.Threading": "4.0.11-beta-*"
  }
}

PS:重新启动Visual Studio无法解决任何问题

PS : rebooting Visual Studio doesn't fix anything

推荐答案

弄清楚会发生什么:我从dotnet5.2输出中选择了DLL.如果我从net45文件夹中选择DLL,则没有编译问题.

Figured out what happens : I picked the DLL from the dotnet5.2 output.If I choose the DLLs from net45 folder, I have no compilation issue.

尽管如此,我必须搜索为什么在创建nuget包时会选择错误的框架并产生错误.

Altough, I have to search why, when create nuget package, it picks the wrong framework and create errors.

这篇关于无法在Xamarin上加载System.Reflection.TypeExtensions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-09 23:31