Is it possible to tell Unity not to auto-upgrade a shader?

I have a Unity 5.4 project that I need to work with Unity 5.1 also.

There’s a shader using the matrix unity_ObjectToWorld in 5.4. I’m using conditional compilation:

  return mul(UNITY_MATRIX_V, mul(_Object2World, float4(pos, 1.0))).xyz;
  return mul(UNITY_MATRIX_V, mul(unity_ObjectToWorld, float4(pos, 1.0))).xyz;

This works in both versions of Unity but as soon as I reimport the shader in Unity 5.4 it auto-upgrades the shader and replaces _Object2World in the conditional with unity_Object2World, breaking the 5.1 version of the project.

Any ideas for a fix that will allow me to keep this backwards compatibility? Is there anything I can add to tell Unity not to auto-upgrade the shader file?

From the 5.4 release notes:

Shaders: Added ability to exclude
shaders from automatic upgrade by
anywhere in shader source file.

I’ve found a workaround until a better solution comes along.

I renamed the compat.cginc file with the conditional compilation in it, to compat.cginchack. So far that stops Unity from auto-upgrading it. It also doesn’t show up in Monodevelop so it’s not great but it gets me by for now. You can #include "compat.cginchack" fine though.