2020-12-27 09:17

Wrong target .NET framework - Ubuntu

When I run the omnisharp server on Ubuntu it starts up, successfully loads example toy projects (auto generated hello world app from the .NET Core installation instructions), but fails to load projects created via Unity -> MonoDevelop. I am loading the project once in Mono to create the solution files as emacs does not do this (to my knowledge. Here is the output:

info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Loading project: /home/alexs/Dropbox/unity/BlockBreaker/Assembly-CSharp.csproj fail: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo[0] The reference assemblies for framework ".NETFramework,Version=v4.0" 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. warn: OmniSharp.MSBuild.MSBuildProjectSystem[0] Failed to load project file '/home/alexs/Dropbox/unity/BlockBreaker/Assembly-CSharp.csproj'. info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Loading project: /home/alexs/Downloads/hwapp/hwapp.csproj info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Update project: test info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Update project: hwapp info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Update project: hwapp info: OmniSharp.Script.ScriptProjectSystem[0] Detecting CSX files in '/home/alexs'. info: OmniSharp.Script.ScriptProjectSystem[0] Could not find any CSX files info: OmniSharp.Startup[0] Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider info: OmniSharp.Startup[0] Configuration finished.

I have traced the error back to the target framework in the .csproj files.

  • Successful load: <TargetFramework>netcoreapp1.1</TargetFramework>

  • Failed load: <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>

Sure enough I get full intellisense and autocompletion in the project with netcoreapp1.1 as the target.

Any suggestions on how to correct this? I think it is something that can/needs to be adjusted in the build setting on MonoDevelop or potentially Unity, but I have tried all of the framework options in MonoDevelop with no success.

Alternately, is there a way to build solutions initially to the right target framework? Sorry, new to C# and the whole solutions thing.

Thank you!


  • 点赞
  • 回答
  • 收藏
  • 复制链接分享