Assembly version prevents hard dependencies from using newer versions
blizzy78 opened this issue ยท 8 comments
Hi, in MJ's assembly, it contains the current version and build number, for example:
MechJeb2, Version=2.2.1.249, Culture=neutral, PublicKeyToken=null
In principle this is all fine, but it poses a serious problem when trying to use MJ as a hard dependency. In my Visual Studio project, I'm referencing the DLL, but in KSP, I have a newer version of MJ. As soon as my assembly runs and Unity tries to resolve the MJ dependency, it all crashes to the desktop with this error in the log:
**** Crash! ****
FileNotFoundException: Could not load file or assembly 'MechJeb2, Version=2.2.1.249, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
I only see two viable options here:
a) I need to create a reflection wrapper to get rid of the hard dependency.
b) The assembly version in MJ needs to remain static. For example, Unity's DLL uses 0.0.0.0, and .NET system DLLs use something like 2.0.0.0.
Yes. It also says
<Reference Include="MechJeb2, Version=2.2.1.249, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\Programme\KSP_24_dev\GameData\MechJeb2\Plugins\MechJeb2.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
in my project file. But it doesn't seem to have any effect, the behaviour is the same as before.
That sucks, i guess because it cannot find it by the version, the hint path and it is not in the GAC it fails :(
a reflection wrapper for MJ, that is a tall order.
So we need to keep AssemblyFileVersion stable ( or AssemblyVersion ? )
Edit : I had r4m0n add a line that change AssemblyVersion for each jenkins build, so that may be the problem.
Yes, this sounds like it is the problem.
I think that since we don't really have a need for (internal) assembly versions in KSP, this could just be set to 0.0.0.0 or something like that, and never change.
Actualy we do have the need since we use it to display MJ version in the windows. But I am sure we can get it elsewhere. I'll talk with r4m0n about it, if he did not read this message before.