C# 如何在Mac机器的Mvc项目中添加程序集?

C# 如何在Mac机器的Mvc项目中添加程序集?,c#,.net,asp.net-mvc,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/brill

应用程序启动异常:System.IO.FileLoadException:无法加载文件或程序集“testapp,Culture=neutral,PublicKeyToken=null”或其依赖项之一。来自HRESULT的常规异常:0x80131500

文件名:“testapp,Culture=neutral,PublicKeyToken=null”-->Microsoft.Dnx.Compilation.CSharp.RoslynCompilationException:/Users/brilliomac/Desktop/testapp/Controller/HomeController.cs26,48:DNXCore,Version=v5.0错误CS1061:“HttpContent”不包含“ReadAsAsync”的定义,并且找不到接受类型为“HttpContent”的第一个参数的扩展方法“ReadAsAsync”。是否缺少using指令或程序集引用

我从中得到了解决办法 我试图将程序集添加到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>

你能确认你正在使用Mac吗

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

这应该是您需要的软件包