"Referenced in" or "referenced from"?

Solution 1:

They're both correct and the meaning is essentially the same. I'd say that the preposition choice depends on how you intend to communicate the message.

If you think of the reference as an arrow in a diagram coming from file X to ABC, then from works better as the preposition, as it indicates movement and direction:

ABC should not be referenced from file X.

If you think of the reference to ABC within the boundaries of file X, then it is in that works better as the preposition, as it indicates inclusion within a space:

ABC should not be referenced in file X.

I would probably write the sentence with from in a technical document, as I usually think of arrows and direction when I'm thinking of references between files or objects.

Solution 2:

Even though other answers say your two sentences mean the same thing, they sound different to me.

ABC should not be referenced in file X.

Sounds to me like file X should not contain any references to ABC.

ABC should not be referenced from file X.

Sounds to be like file X contains an ABC that nothing else should reference. If that's the intended meaning, then I would use:

ABC from file X should not be referenced.

There might be an ABC in a different file that could be referenced, but the one in file X should not be referenced.

Solution 3:

Both usages are completely correct, and there's no difference in meaning between them that I can perceive. Use whichever one you feel more comfortable with.