FastScriptReload icon indicating copy to clipboard operation
FastScriptReload copied to clipboard

Visual Studio Code: Omnisharp can't resolve primary reference "0Harmony"

Open Tuntenfisch opened this issue 2 years ago • 2 comments

I'm using Visual Studio Code and Omnisharp complains that it cannot resolve "0Harmony" because it was built against a different framework version (v4.8) than the currently targeted one (v4.7.1):

[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file 'c:\dev\unity\Simulator\FastScriptReload.Runtime.csproj'.
c:\dev\unity\Simulator\FastScriptReload.Runtime.csproj
C:\Program Files\dotnet\sdk\7.0.103\Microsoft.Common.CurrentVersion.targets(2352,5): Error: The primary reference "0Harmony" could not be resolved because it was built against the ".NETFramework,Version=v4.8" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.7.1".

Some more info:

  • FastScriptReload 1.4-rc1
  • Unity 2022.2.10
  • Visual Studio Code Version: 1.77.0 (system setup) Commit: 7f329fe6c66b0f86ae1574c2911b681ad5a45d63 Date: 2023-03-29T10:02:16.981Z Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Windows_NT x64 10.0.19045 Sandboxed: Yes
  • Visual Studio Code C# Extension Id: ms-dotnettools.csharp Description: C# for Visual Studio Code (powered by OmniSharp). Version: 1.25.4 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp

Is there any way to resolve this issue?

Tuntenfisch avatar Apr 06 '23 20:04 Tuntenfisch

Hi, thanks for raising.

It's down to VSCode proj file adding some specific version of framework.

There are some workarounds, easiest probably to replace harmony dll with 4.8 compiled one. Attached is harmony targetting 4.8 that one of the guys on Discord compiled and shared

publish.zip

Also some more chat on Discord for that https://discord.com/channels/1054303923743227925/1054304339868516372/1093077874430464102

handzlikchris avatar Apr 07 '23 09:04 handzlikchris

need to add info in FAQ / docs secion

handzlikchris avatar Apr 07 '23 09:04 handzlikchris