我在尝试让NUInt和PCL库协调时,遇到了各种问题。我的PCL库是面向.NET 4.5、Silverlight 4及更高版本、Windows Phone 7.5、Windows Store、Mono for Android和MonoTouch(最后两个使用Xamarin)。但是,当我通过NuGet尝试将NUnit添加到该项目中时,似乎已经添加成功了(nunit.framework已添加到引用),但是NUnit命名空间不可用。如果我尝试添加using NUnit.Framework
,Visual Studio会将其下划线化,如果我尝试构建,就会出现关于NUnit
命名空间无法找到的错误以及以下警告:
Warning 2 The primary reference "nunit.framework" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile104". To resolve this problem, either remove the reference "nunit.framework" or retarget your application to a framework version which contains "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
NUnit是否可以与PCL配合使用?看起来mvvm cross教程可以做到。
我尝试为测试创建一个单独的项目(普通的类库),并且可以将NUnit添加到该项目中,但是我似乎无法将引用添加到我的PCL库(我想要测试的那个库),所以也没有帮助。
有任何想法吗?