2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rider で System.Web.Http が見つからない問題

Last updated at Posted at 2018-10-22

問題

ASP.net MVC のプロジェクトで Web API を使うために System.Web.Http をインポートしようとしたところ、Cannot resolve symbol 'Http' と怒られてしまいました。

OS - Windows 10 pro
IDE - Rider 2018.2.3
.NetFramework - 4.6.1

解決

↓のリンクによると、nugetでインストールする必要があるそうです。
https://stackoverflow.com/questions/27819109/system-web-http-missing-after-net-4-5-upgrade

  1. ツールバーから Tools > NuGet > Manage NuGet Packages for [Project Name] を選択
  2. 検索バーに Microsoft.AspNet.WebApi を入力
  3. 検索結果を選択し、インストールボタンを押す

System.Web.Http は Core で解決しますが、ほかの WebAPI の機能を使うには Microsoft.AspNet.WebApi のほかのパッケージもインストールが必要です。

Microsoft.Net.Compilers のエラーが出る場合

自分の環境では、↓のようなエラーで WebAPI がインストールできませんでした。

Unable to resolve dependencies. 'Microsoft.Net.Compilers 1.3.2' is not compatible with 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.8 constraint: Microsoft.Net.Compilers (>= 2.4.0)'.

メッセージによると Microsoft.Net.Compiler のバージョンが古い(要求2.4.0以上に対し1.3.2がインストールされている)とのことなので、NuGetからアップデートします。

  1. ツールバーから Tools > NuGet > Manage NuGet Packages for [Project Name] を選択
  2. 検索バーに Microsoft.Net.Compilers を入力
  3. 検索結果を選択し、アップデートボタンを押す
  4. アップデートが終わったら再度 Micorosft.AspNet.WebApi.Core を検索してインストール
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?