Docking Port Sound FX

Docking Port Sound FX

1.5k Downloads

Wrong target framework version

HebaruSan opened this issue · 5 comments

commented

KSP mods should have v3.5 here:

<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>

Originally reported by forum user Tonka Crash at:
https://forum.kerbalspaceprogram.com/index.php?/topic/183869-mods-with-wrong-net-target-framework/

commented

You need to be more verbose, what problem would changing this solve? As far as I know it has been working fine.

I'm not contesting this, I want to learn.

commented

The compiler (unless you're lucky) will generate code that uses parts of the v4.5.2 version of the .NET runtime that are not available on the v3.5 version actually used by KSP (new classes, new functions, etc.). Then when the plugin tries to use those parts, it won't work.

The user on the linked forum thread reported the below exception, but since it references TargetFrameworkAttribute instead of a specific piece of functionality, I suspect it's coming from an explicit safety check somewhere rather than what I mentioned in the previous paragraph:

[EXC 22:11:47.643] TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'DecouplerShroud'.
	System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType)
	System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit)
	System.Reflection.Assembly.GetCustomAttributes (System.Type attributeType, Boolean inherit)
	Kopernicus.LogAggregatorWorker.Awake ()
	UnityEngine.GameObject:AddComponent(Type)
	AddonLoader:StartAddon(LoadedAssembly, Type, KSPAddon, Startup)
	AddonLoader:StartAddons(Startup)
	<LoadObjects>c__Iterator1:MoveNext()
	UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
	<CreateDatabase>c__Iterator0:MoveNext()
	UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
	GameDatabase:StartLoad()
	<LoadSystems>c__Iterator0:MoveNext()
	UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
commented

I dont have VS installed at the moment, so tell me, which version did you recompile on? I'll fix it and release an update. (I think I was on VS2015 when I wrote this)

commented

I have not attempted to compile this at all. I'm just reporting that the project isn't set up right.

commented