MechJeb2

MechJeb2

4M Downloads

Unable to Build MechJebLib (missing TryAdd)

schlosrat opened this issue ยท 4 comments

commented

Following the Build instructions for Windows with Unity 2019.2.2f1 installed, environment variables set, and references path pointing to the right local folder, I am unable to build MechJebLib with the following errors appearing.

Severity Code Description Project File Line Suppression State
Error CS1061 'Dictionary<int, SimFlowMode>' does not contain a definition for 'TryAdd' and no accessible extension method 'TryAdd' accepting a first argument of type 'Dictionary<int, SimFlowMode>' could be found (are you missing a using directive or an assembly reference?) MechJebLib F:\KSP1Mods\MechJeb2\MechJebLib\FuelFlowSimulation\PartModules\SimModuleEngines.cs 335 Active
Error CS1061 'Dictionary<int, SimFlowMode>' does not contain a definition for 'TryAdd' and no accessible extension method 'TryAdd' accepting a first argument of type 'Dictionary<int, SimFlowMode>' could be found (are you missing a using directive or an assembly reference?) MechJebLib F:\KSP1Mods\MechJeb2\MechJebLib\FuelFlowSimulation\PartModules\SimModuleRCS.cs 148 Active

This is with a fresh clone of the current Dev branch. This issue is preventing building MechJeb2 since it depends on MechJebLib.

commented

Solution found. Step 3 of the Windows build process is no longer correct. It only indicates adding the folder to the References PAth section for the MechJeb2 project, but in fact you also need it on the MechJebLib and presumably the MechJebLibBindings projects. Correcting that deficiency gets past the issue above, but leads to issues with JetBrainsAnnotations where numerous places report errors like these samples

Severity Code Description Project File Line Suppression State
Error CS0430 The extern alias 'JetBrainsAnnotations' was not specified in a /reference option MechJeb2 F:\KSP1Mods\MechJeb2\MechJeb2\ModExtensionDemo.cs 1 Active
Error CS0234 The type or namespace name 'JetBrains' does not exist in the namespace 'JetBrainsAnnotations' (are you missing an assembly reference?) MechJeb2 F:\KSP1Mods\MechJeb2\MechJeb2\AttitudeControllers\BetterController.cs 3 Active
Error CS0246 The type or namespace name 'UsedImplicitly' could not be found (are you missing a using directive or an assembly reference?) MechJeb2 F:\KSP1Mods\MechJeb2\MechJeb2\AttitudeControllers\BetterController.cs 36 Active
Error CS0246 The type or namespace name 'UsedImplicitlyAttribute' could not be found (are you missing a using directive or an assembly reference?) MechJeb2 F:\KSP1Mods\MechJeb2\MechJeb2\AttitudeControllers\BetterController.cs 40 Active

This is despite having installed JetBrains.Annotations via VS Package Manager for the MechJeb2 project.

Suggest (at minimum) updating the Windows Build instructions in the README to enable new users to get past these issues.

commented

More solutions found... Installing JetBrains.Annotations via VS Package Manager did some shenanigans with the csproj file. Reverting those changes got things working, so I would also add that - since the code seems to depend on JetBrains.Annotations, there should be instructions on how to install that without hosing the csproj.

Please keep this issue open until the build instructions have been updated so that others following them don't encounter these issues.

commented

"nuget restore", like any project that uses external deps.

commented

Are you suggesting that nuget restore would have sorted out the issue where other projects needed Step 3 besides just MechJeb2? I don't think this is so, and as such the build instructions do need to be updated. If, on the other hand, you're indicating that a nuget restore would have taken care of getting JetBrains.Annotations then perhaps it would not hurt to call for that step as well.