如何在Mac机器的Mvc Project中添加程序集?

时间:2015-11-05 14:55:38

标签: c# .net asp.net-mvc

应用程序启动异常:System.IO.FileLoadException:无法加载文件或程序集' testapp,Culture = neutral,PublicKeyToken = null'或其中一个依赖项。一般例外(HRESULT异常:0x80131500

文件名:' testapp,Culture = neutral,PublicKeyToken = null' ---> Microsoft.Dnx.Compilation.CSharp.RoslynCompilationException:/Users/brilliomac/Desktop/testapp/Controllers/HomeController.cs(26,48):DNXCore,Version = v5.0错误CS1061:' HttpContent'不包含' ReadAsAsync'的定义没有扩展方法' ReadAsAsync'接受第一个类型' HttpContent'可以找到(你错过了使用指令或汇编引用吗?)

我从这个link得到了解决方案 我试图将程序集添加到web.config仍然得到同样的错误

我的web.config文件

<?xml version="1.0" encoding="utf-8"?>
 <configuration>
  <system.webServer>
   <handlers>
     <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
   </handlers>
   <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false"/>
  </system.webServer>
  <system.web> 
   <compilation debug="true" targetFramework="4.0">
     <assemblies>
         <add assembly="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
     </assemblies>
   </compilation>
  </system.web> 
</configuration>

也尝试了这个

<system.webServer>
   <handlers>
     <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
   </handlers>
   <assemblies>
         <add assembly="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   </assemblies>
   <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false"/>
</system.webServer>

1 个答案:

答案 0 :(得分:0)

您能否确认使用的是Mac?

我会使用命令dnu install Microsoft.AspNet.WebApi.Client,然后尝试重新编译。这应该有望解决您的问题。

这应该是您需要的包裹。

相关问题