System.Web.Compilation.CompilationException编译在MAC上为此请求.Net提供服务所需的资源时出错

时间:2017-08-01 09:45:24

标签: asp.net asp.net-mvc web-services xamarin.ios mono

System.Web.Compilation.CompilationException CS0012:类型System.Net.Http.HttpMethod' is defined in an assembly that is not referenced. Consider adding a reference to assembly System.Net.Http,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'

描述:编译为此请求提供服务所需的资源时出错。检查您的源文件并对其进行修改以修复此错误。 详细信息:CS0012:类型System.Net.Http.HttpMethod' is defined in an assembly that is not referenced. Consider adding a reference to assembly System.Net.Http,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a' 错误来源:编译器 错误源文件:/Users/x/x/x/x/x/x/Areas/HelpPage/Views/Help/DisplayTemplates/ApiGroup.cshtml

异常堆栈跟踪:   在System.Web.Compilation.AssemblyBuilder.BuildAssembly

    (System.Web.VirtualPath virtualPath, System.CodeDom.Compiler.CompilerParameters options) [0x002fa] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs:853 
  at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs:731 
  at System.Web.Compilation.BuildManager.GenerateAssembly (System.Web.Compilation.AssemblyBuilder abuilder, System.Web.Compilation.BuildProviderGroup group, System.Web.VirtualPath vp, System.Boolean debug) [0x00202] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:826 
  at System.Web.Compilation.BuildManager.BuildInner (System.Web.VirtualPath vp, System.Boolean debug) [0x00106] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:451 

错误源上下文: 错误行:10,27,36

8: @{
9:     var controllerDocumentation = ViewBag.DocumentationProvider != null ? 
10:         ViewBag.DocumentationProvider.GetDocumentation(Model.Key) : 
11:         null;
12: }

1 个答案:

答案 0 :(得分:0)

在项目中扩展您的引用,然后检查是否添加了引用,如果没有,则右键单击它然后添加所需的引用

enter image description here

enter image description here