繁体   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