6
6

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.

Visual Studio Code for Mac C# 試したら、インテリセンスが効かずエラーが出たのでその対処

Posted at

単なるじぶんに対するメモ。

.NET Core 入っているのにインストールしろと言われる

Visual Studio Code で C# を Mac から試したら、何やらエラーが出てうまく動かなかった。.NET Core を入れろや!というエラーメッセージが出てくるのだが、そんなものとっくに入っている。ちなみに

$ dotnet --info
.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.0.0/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

ちゃんと動くし。インターネットで調べるとバグという話もあるが、載っている開放ではうまくいかない。
下記のようなエラーも出ていた。

.net core mac Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found.

このポストで、Windows の場合複数バージョンがあるとダメみたいなことが書いてあったので、ふと思いついて、.NET Core を消して再起動するとうまくいった。

.NET Core を Mac で 再インストールしてみる

# delete the dotnet folder under /usr/local/share/dotnet
1. cd /usr/local/share/dotnet && ls
2. sudo rm -rf dotnet

# delete the dotnet reference file at /etc/paths.d/dotnet
1. cd /etc/paths.d && ls
2. sudo rm dotnet

これでおっけー。インテリセンス!これないとC# のよさ半減よね。

Screen Shot 2017-10-10 at 11.56.13 AM.png
6
6
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
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?