LoginSignup
18

More than 3 years have passed since last update.

Unity2019 + mac + VisualStudioCodeで、補完が効かなくなった時の対処メモ

Last updated at Posted at 2020-03-14

環境

  • mac OS 10.15.1
  • Unity2019 2.12f1 (.Net4)
  • Visual Studio Code 1.43.0

Visual Studio Codeを使っていて、補完が効かなくなり、
下記エラーに遭遇、以前に設定した解決したけど、忘れてしまったので自分用に再度メモ。

OmniSharp.MSBuild.ProjectLoader
        The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks

https://aka.ms/msbuild/developerpacks
エラーを参考にこのリンクをたどっていってもmac用のそれらしいファイルが見当たらず、
windows用はあった、またVisualStudioならできるような情報もあったが、VSCodeのみで
完結したかったので参考になったので下記記事!

https://qiita.com/kyasbal_1994/items/ecf19a3feb60a12a61f9
m(_ _)mありがたや

手順メモ

1. まず下記extensionがVSCodeに入っている前提

image.png

2. ターミナルで、monoを入れておく。

$ brew install mono

※状況のおおじて、最新版を入れておくといいかも→ brew upgrade mono

3. VSCodeのユーザー設定ファイルのsetting.jsonに下記monoの設定を記入

コマンドパレット(Cmd+Shift+P)で、「setting json」などで検索

setting.json
{
    〜省略〜
    "omnisharp.useGlobalMono": "always",
    "omnisharp.monoPath": "/usr/local/Cellar/mono/6.8.0.105"
}

/usr/local/Cellar/mono/6.8.0.105は、monoインストール時のパスを入力する

何かが原因でmonoがアップデートされてしまったらこのパスのバージョンも書き換える必要あり、
下記monoフォルダ内にバージョン番号名のフォルダがあるのでそこで確認する。

$ open /usr/local/Cellar/mono/6.8.0.123/

あとは、VSCode再起動で改善した!

image.png

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
18