LoginSignup
37
20

More than 5 years have passed since last update.

MacでVSCodeがうまくUnityのコードを補完してくれないとき

Posted at

なんか中途半端に予測が聞かない。VSCodeのOmni Sharpのログを見るとProjectがうまく読めていないことがわかった。

 The reference assemblies for framework ".NETFramework,Version=v4.7.1" were not found. To resolve this, 
install the SDK or Targeting Pack for this framework version or retarget your application to a version of the 
framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from 
the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may 
not be correctly targeted for the framework you intend.

.Net Coreでは.net 4.5相当のコードを実行することはできないのでMonoを入れる必要がある。

brew install mono

前に入れた覚えがある人はbrew upgrade monoをして最新版にしよう。
その上でVSCodeの設定に以下のようなものを足す。

  "omnisharp.useGlobalMono": "always",
  "omnisharp.monoPath": "/usr/local/Cellar/mono/5.16.0.220"

下のmonoPathは執筆時点で最新のバージョンを具体的に示したものだが、僕の環境ではPATHに通っていたとしても、このように強制的にMonoのパスを示していない場合は動作をしなかった。

37
20
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
37
20