我使用Is it possible to use a Portable Class Library that references System.Net in MonoDroid?
中接受的答案中的建议实施了多条TypeForwardedTo
路线
但是,我现在正在尝试将TypeForwardTo(System.Windows.Input.ICommand)添加到列表中,由于某种原因,此类型拒绝工作。
基本上我收到的错误信息是:
错误5名称空间'System'中不存在类型或命名空间名称'Windows'(您是否缺少程序集引用?)C:\ Projects \ Misc \ MVVMCROSS \ Cirrious \ System.Windows.Touch \ Forwarding。 cs 9 42 System.Windows.Touch
我不明白为什么这就像我在Reflector中查看System.dll的VSMonoTouch副本那样我可以清楚地看到ICommand类型:
.namespace System.Windows.Input
{
.class public interface abstract auto ansi ICommand
{
.event [mscorlib]System.EventHandler CanExecuteChanged
{
.addon instance void System.Windows.Input.ICommand::add_CanExecuteChanged(class [mscorlib]System.EventHandler)
.removeon instance void System.Windows.Input.ICommand::remove_CanExecuteChanged(class [mscorlib]System.EventHandler)
}
.method public hidebysig newslot abstract virtual instance bool CanExecute(object parameter) cil managed
{
}
.method public hidebysig newslot abstract virtual instance void Execute(object parameter) cil managed
{
}
}
}
System.dll中的其他类型转发正常 - 即只有最后一行失败:
[assembly: TypeForwardedTo(typeof(System.Collections.ObjectModel.ObservableCollection<>))]
[assembly: TypeForwardedTo(typeof(System.Collections.ObjectModel.ReadOnlyObservableCollection<>))]
[assembly: TypeForwardedTo(typeof(System.Collections.Specialized.INotifyCollectionChanged))]
[assembly: TypeForwardedTo(typeof(System.Collections.Specialized.NotifyCollectionChangedAction))]
[assembly: TypeForwardedTo(typeof(System.Collections.Specialized.NotifyCollectionChangedEventArgs))]
[assembly: TypeForwardedTo(typeof(System.Collections.Specialized.NotifyCollectionChangedEventHandler))]
[assembly: TypeForwardedTo(typeof(System.Windows.Input.ICommand))]
此外: - 我知道MonoDroid的重定向工作正常.... - 我知道最近在MonoTouch中添加了System.Windows.Input.ICommand - 我怀疑VSMonoTouch使用1.0的.Net Framework版本也可能导致一些问题(但我不确定我是否完全理解这一点)。
有人能说出这可能是什么原因造成的?什么可能治愈?