LavaGang / MelonLoader

The World's First Universal Mod Loader for Unity Games compatible with both Il2Cpp and Mono
https://discord.gg/2Wn3N2P
Apache License 2.0
2.25k stars 461 forks source link

[Bug]: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' #484

Open Bluscream opened 1 year ago

Bluscream commented 1 year ago

All of the following criteria must be met

All of the following are optional to answer

Describe the issue.

[12:14:04.105] ------------------------------
[12:14:04.130] MelonLoader v0.6.1 Open-Beta
[12:14:04.132] OS: Windows 11
[12:14:04.132] Hash Code: 3FAB1593D3EDAF450F4BDDC6FC28134A9535995F28E9B255983B3D1FE925E35
[12:14:04.132] ------------------------------
[12:14:04.421] Game Type: MonoBleedingEdge
[12:14:04.421] Game Arch: x64
[12:14:04.422] ------------------------------
[12:14:04.422] Core::BasePath = D:\SteamLibrary\steamapps\common\Storm Chasers
[12:14:04.422] Game::BasePath = D:\SteamLibrary\steamapps\common\Storm Chasers
[12:14:04.514] Game::DataPath = D:\SteamLibrary\steamapps\common\Storm Chasers\Storm Chasers_Data
[12:14:04.604] Game::ApplicationPath = D:\SteamLibrary\steamapps\common\Storm Chasers\Storm Chasers.exe
[12:14:04.604] Runtime Type: net35
[12:14:04.795] ------------------------------
[12:14:04.795] Game Name: Storm Chasers
[12:14:04.795] Game Developer: Little Cloud Games
[12:14:04.796] Unity Version: 2018.4.23f1
[12:14:04.796] Game Version: 0.8.0
[12:14:04.796] ------------------------------

[12:14:05.107] Preferences Loaded!

[12:14:05.225] Loading Plugins from 'D:\SteamLibrary\steamapps\common\Storm Chasers\Plugins'...
[12:14:05.227] 0 Plugins loaded.

[12:14:06.143] Loading Mods from 'D:\SteamLibrary\steamapps\common\Storm Chasers\Mods'...
[12:14:06.144] ------------------------------
[12:14:06.148] Melon Assembly loaded: '.\Mods\StormChasers.dll'
[12:14:06.148] SHA256 Hash: 'd8bebf069a8f5e1cc7db1cc29b2af5f62cb72e02dac33297db0fb1caf69ce95d'
[12:14:06.152] Melon Assembly loaded: '.\Mods\TestMod.dll'
[12:14:06.152] SHA256 Hash: 'd3968793b9994ddaf166626d19ad3a37c8ed5d0750d8837f62708f6ef644542d'
[12:14:06.155] Melon Assembly loaded: '.\Mods\UnityVRPatcher.dll'
[12:14:06.155] SHA256 Hash: '89988f164185e64780fcd4b1eef777bea46286b776347e1cae9c1962b2cf5a6e'
[12:14:06.162] System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'StormChasers'.
  at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool)
  at System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType) [0x00000] in <filename unknown>:0 
  at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, Boolean inherit) [0x00000] in <filename unknown>:0 
  at System.Reflection.Assembly.GetCustomAttributes (Boolean inherit) [0x00000] in <filename unknown>:0 
  at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, Boolean inherit) [0x00000] in <filename unknown>:0 
  at MelonLoader.MelonUtils.PullAttributesFromAssembly[MelonInfoAttribute] (System.Reflection.Assembly asm, Boolean inherit) [0x00000] in <filename unknown>:0 
  at MelonLoader.MelonUtils.PullAttributeFromAssembly[MelonInfoAttribute] (System.Reflection.Assembly asm, Boolean inherit) [0x00000] in <filename unknown>:0 
  at MelonLoader.MelonAssembly.LoadMelons () [0x00000] in <filename unknown>:0 
  at MelonLoader.MelonHandler.LoadMelonsFromDirectory[MelonMod] (System.String path) [0x00000] in <filename unknown>:0 
  at MelonLoader.Core.Start () [0x00000] in <filename unknown>:0 

This is with the mod compiled as .NET 7.2; 3.5 won't compile :

Severity    Code    Description Project File    Line    Suppression State
Warning     The primary reference "Assembly-CSharp" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.   Storm Chasers           

Bepis addressed this issue with unity assets with different handling of references that i use, but obv they don't include the specific game's assembly-csharp

Did you attach your log file?

xNasuni commented 11 months ago

i am having the same error "System.Runtime.Versioning.TargetFrameworkAttribute"

rakosi2 commented 10 months ago

try compiling the mod with .NET 6.0

xNasuni commented 10 months ago

i fixed this by compiling my project with net35 or net472 as you can see that game's runtime is net35 (you can tell by the log) so you should download this and use it as the build target framework version in visual studio

Bluscream commented 10 months ago

i fixed this by compiling my project with net35 or net472 as you can see that game's runtime is net35 (you can tell by the log) so you should download this and use it as the build target framework version in visual studio

Bluscream commented 10 months ago

How is this completed?

xNasuni commented 10 months ago

try 4.7.2 runtime, and what exactly happens when you try to compile with 3.5? if you wish you can add me on discord so i can try helping you better and you can close it with the solution

xNasuni commented 10 months ago

--, try downgrading melon loader to 0.5.7, might help.

xNasuni commented 9 months ago

@Bluscream ?

Bluscream commented 9 months ago

Older ML worked

xNasuni commented 9 months ago

close the issue !

Bluscream commented 9 months ago

Why would i close it when the error still exists with latest ML?

xNasuni commented 9 months ago

latest ml is buggy and a lot of modders just use 0.5.7 anyway as i heard from the discord