看来我应该打开project.json并添加如下内容:"System.Web.Http": "<some version number>"在依赖项下.我不知道要使用哪个版本号,所以我尝试了最新",但是无论何时我运行dnu update,都说找不到System.Web.Http.在哪里可以找到有关添加对Visual Studio Code的引用的信息?如何引用特定的DLL(对我来说尤其是System.Web.Http)以及要引用什么版本?解决方案您的问题的答案分为几个部分. ApiController 首先,ASP.NET MVC 6将WebAPI和MVC 5控制器统一为一个.如果愿意,您仍然可以使用ApiController,但是您将需要Microsoft.AspNet.Mvc.WebApiCompatShim.没有System.Web.Net 第二, Matt DeKrey 是正确的. System.Web.Http不是.NET核心库.根据您尝试执行的操作,您可能正在寻找System.Web.Http.Common.查找程序包版本使用VS Code时,您应该会看到自动完成功能,它将为您推荐版本号.在这种情况下,您可以使用:"System.Web.Http.Common": "4.0.20216.16343" I'm new to mac but not .Net. I'm playing around with Visual Studio Code. I installed Brew and used it to get yo, grunt-cli, generator-aspnet, dnvm, and everything the tutorials say to get. I created a project scaffold with yo and the first thing I want to do is add a Controller that inherits from ApiController but I can't seem to find a way to "Add a reference" like I would in Visual Studio proper.It looks like I should open project.json and add something like this:"System.Web.Http": "<some version number>"under dependencies. I don't know what version number to use, so I tried "latest" but anytime I run dnu update it says System.Web.Http can't be found.Where can I find information about adding references to Visual Studio Code? How to reference particular DLLs (specifically System.Web.Http for me) and what versions to reference? 解决方案 The answer to your question has several parts.ApiControllerFirst of all, ASP.NET MVC 6 unifies WebAPI and MVC 5 controllers into one. You can still use ApiController if you want to, but you will need Microsoft.AspNet.Mvc.WebApiCompatShim.There is no System.Web.NetSecond, Matt DeKrey is correct. System.Web.Http is not a .NET core library. Depending on what you are trying to do, you may be looking for System.Web.Http.Common.Finding package versionWhen using VS Code, you should be seeing autocomplete that will recommend version numbers for you. In this case you could use:"System.Web.Http.Common": "4.0.20216.16343" 这篇关于在Mac OS X上使用System.Web.Http的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-23 11:24