C#CodeDom System.TypeLoadException XamMac2 Xamarin macOS

问题描述 投票:0回答:1

我正在编写一个复杂的应用程序,该应用程序使用CodeDom实例化反射对象。但是,它混合在netstandard2.0(之间的包装程序也支持net461)和net461项目之间。

正如我读过的,很有可能引用该框架的先前版本,在这种情况下如下:

{System.TypeLoadException: Could not resolve type with token 01000067 from typeref (expected class 'System.CodeDom.Compiler.CompilerParameters' in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')  

忽略Xamarin Mac可执行文件加载到内存中的系统参考。

不适合的代码是寻找可能被Xamarin System程序集覆盖的System程序集。

您知道任何解决方法吗?除了将其余项目完全迁移到netstandard2.0和net461之间进行混合之外。

谢谢。

c# macos xamarin codedom xamarin.mac
1个回答
0
投票

的确。

[打包在System.dll中的System.CodeDom程序集与要构建的项目必须引用的程序集之间不匹配。

这通过同时设置两个net461的netstandard2.0来解决。

  <PropertyGroup>
    <TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
  </PropertyGroup>

类似。

© www.soinside.com 2019 - 2024. All rights reserved.