簡體   English   中英

在Mac上使用.NET中的.NET 4.x.

[英]Using .NET 4.x in Unity on a Mac

如何在MAC上使用.NET 4.x並使用VSCode作為編輯器!

我將這些設置設置為統一:

在此輸入圖像描述

在VScode中我收到以下錯誤:

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. Failed to load project file '/Data/unity_learn/RIG/Assembly-CSharp.csproj'. /Data/unity_learn/RIG/Assembly-CSharp.csproj /Users/doekewartena/.vscode/extensions/ms-vscode.csharp-1.16.0/.omnisharp/1.32.4/omnisharp/msbuild/15.0/Bin/Microsoft.Common.CurrentVersion.targets(1195,5): Error: 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. 我找不到mac的4.x版下載。

Omnisharp默認使用dotnet,如果它可用,這對於你需要的東西是不夠的。 要使omnisharp使用mono(附帶所需的配置文件),您需要:

  1. 安裝5.8或更高版本的mono。 我建議使用自制軟件brew install monobrew install mono
  2. 在VSCode的用戶設置文件中,強制omnisharp使用全局單聲道安裝: "omnisharp.useGlobalMono": "always"auto

VSCode中的輸出應該顯示類似的內容

[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    Located 2 MSBuild instance(s)
        1: Mono 15.0 - "/usr/local/lib/mono/msbuild/15.0/bin"
        2: StandAlone 15.0 - "/Users/x/vscode/extensions/ms-vscode.csharp-1.17.1/.omnisharp/1.32.8/omnisharp/msbuild/15.0/Bin"

[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    Registered MSBuild instance: Mono 15.0 - "/usr/local/lib/mono/msbuild/15.0/bin"

如果它仍然在這樣做后抱怨(如果,假設它選擇了錯誤的單聲道安裝),你也可以通過設置強制omnisharp使用自制單聲道

"omnisharp.monoPath": "/usr/local/"

或具有單聲道的特定安裝

"omnisharp.monoPath": "/usr/local/Cellar/mono/5.14.0.177/"

你可以在mac中使用visual studio 2017

你必須使用.NET Core而不是.NET Framework,核心只有2.1

不幸的是,看看這個其他類似的問題。

這里

前兩個答案將告訴您需要知道的內容。

去這里下載這個https://www.microsoft.com/net/download

對於mac osx它可能也缺少一些環境變量。 嘗試重新安裝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM