c# - Xamarin/Mono 找不到 System.Core

标签 c# mono nunit xamarin

我在 Xamarin 下有一个测试项目,当我尝试运行它时,它告诉我它无法加载 System.Core,尽管从屏幕截图中可以清楚地看出 System.Core 是引用之一。

这里可能出现什么错误?

(在新选项卡中打开图像以查看其完整详细信息)

xamarin test error

问题似乎出在我的主要项目而不是测试项目。什么时候 我看了所有的引用文献,它们都是红色的。所以我删除了它们并尝试了 再次添加它们,但没有要添加的引用。请参见下图。

enter image description here

最佳答案

对 .csproj 文件进行以下编辑修复了问题

--- a/SketchSolveC#/SketchSolveC#.csproj
+++ b/SketchSolveC#/SketchSolveC#.csproj
@@ -6,12 +6,9 @@
     <ProductVersion>12.0.0</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{46D849FA-8E4B-4656-B494-290697EBD9EC}</ProjectGuid>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <OutputType>Library</OutputType>
     <RootNamespace>SketchSolveC</RootNamespace>
     <AssemblyName>SketchSolveC#</AssemblyName>
-    <TargetFrameworkProfile>Profile1</TargetFrameworkProfile>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -30,15 +27,13 @@
     <ConsolePause>false</ConsolePause>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-    <Reference Include="System.Core" />
-  </ItemGroup>
-  <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="SketchSolve.cs" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Data.Linq" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
   </ItemGroup>
-  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
   <ProjectExtensions>
     <MonoDevelop>
       <Properties>
@@ -49,4 +44,4 @@
       </Properties>
     </MonoDevelop>
   </ProjectExtensions>
-</Project>
\ No newline at end of file
+</Project>

关于c# - Xamarin/Mono 找不到 System.Core,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16840550/

相关文章:

c# - 使用 jQuery $.Ajax 将 DTO 连同附加参数传递给 WebMethod

c# - 什么是像样的 Mono 编辑器?

visual-studio-2010 - 将“nunit-console”输出重定向到Visual Studio输出窗口

c# - 如何在 nunit 中测试泛型集合?

c# - 模拟 StreamReader

C# 自动属性 ​​- += 后仍然为空?

c# - .net 标签加速键事件

c# - 如果我在 c# 中注册一个事件,而它正在调度,我是否保证在该调度期间不会再次被调用?

c# - 具有 volatile 或锁定的属性

c# - 是否可以在 Xamarin 表单内容页面和 Android Activity 之间导航?