HELP - StaticConstructorOnStartup could not be found

Started by Brrainz, July 23, 2016, 05:10:40 PM

Previous topic - Next topic

Brrainz

Hi,

I'm new to modding so in order to get to my own mod, I am trying to compile a rather simple existing example from GitHub. Since I will have to do Detours later, I chose DevSpeedEnabler and can get it almost working.

Problem is, that I cannot get it to completely compile. It complains about "The type of namespace name 'StaticConstructorOnStartup' could not be found (are you missing a using or an assembly reference)".

The file TexButton.cs starts with

using System;
using Verse;
using UnityEngine;

and I went to the project settings and added a reference folder that contains three dll's:


  • Assembly-CSharp.dll
  • Community Core Library.dll
  • UnityEngine.dll

which solves the entries in the projects "References" section.

Those come from RimWorld1241Mac as I am using OSX with VisualStudio Community 2016 running in VMWare and from the latest Community Core Library. At this point I am not sure what else to do.

Can anybody help me out?

[attachment deleted by admin - too old]

1000101

I'm assuming you loaded the solution and not just the project file.

The code looks good.  Not sure why it can't find it.

using System;

namespace Verse
{
  [AttributeUsage(AttributeTargets.Class, Inherited = false)]
  public class StaticConstructorOnStartup : Attribute
  {
    public StaticConstructorOnStartup()
    {
      base..ctor();
    }
  }
}
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Brrainz

Hmm  :-\

It is weird that when I use ILSpy on my Assembly-CSharp.dll from RimWorld1241Mac I cannot find the code you posted. Is this attribute no longer supported?

RawCode

attribute is supported.

check your workspace, check IDE errors and try again.

Brrainz

Solved. Still need help understanding though.

The problem is that the dll's from the steam version and the standalone DRM-free version (at least on OSX) are different. The attribute is defined in the drm free version but not with steam.

Also: Widgets.ButtonImage is called Widgets.ImageButton depending on which version you use.

Anybody wants to explain? I would of course want to make a mod that works on any variant of Rimworld...

/Andreas

skullywag

Wait, that attribute isnt in the steam version??? that makes no sense, can someone confirm this im not near my pc.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

1000101

The DLLs are exactly the same.  You must be comparing A12 (or earlier) to A14 DLLs.  The dead giveaway that you are is that "Widgets.ImageButton" is A13 (and earlier) and "Widgets.ButtonImage" is A14.

Further, "StaticConstructorOnStartup" was introduced in A13 which means the DLL which has "Widgets.ImageButton" and lacks "StaticConstructorOnStartup" is an A12 (or earlier) DLL.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Brrainz

Yeah,

Some funky Steam stuff. I forced an update on Steam and voila! - same DLLs.

Thanks for the help! I got my first two mods almost ready on the first day. I will release them probably tomorrow.

Cheers,
Andreas