This thread is effectively a duplicate of the following thread: http://community.monogame.net/t/solved-conditional-compilation-of-pipeline-content-based-on-visual-studio-project-platform/11620
See there for details.
The short of it is, removing the "/platform" line from Content.mgcb seems to address this issue.
I released my game back in October last year and then went and took a 6 month contract to beef up the ol' finances. I'm back at game development and working on a new game; however, there's some updates I need to do to my previous title. I'm now getting the following exception at runtime while trying to load one of my shaders...
[0:] System.Exception: This MGFX effect was built for a different platform!
at Microsoft.Xna.Framework.Graphics.Effect.ReadHeader (System.Byte effectCode, System.Int32 index) [0x0009d] in <14285e7be6444bda94a4048e3cb68e5b>:0
at Microsoft.Xna.Framework.Graphics.Effect..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice, System.Byte effectCode, System.Int32 index, System.Int32 count) [0x00007] in <14285e7be6444bda94a4048e3cb68e5b>:0
at Microsoft.Xna.Framework.Content.EffectReader.Read (Microsoft.Xna.Framework.Content.ContentReader input, Microsoft.Xna.Framework.Graphics.Effect existingInstance) [0x00024] in <14285e7be6444bda94a4048e3cb68e5b>:0
at Microsoft.Xna.Framework.Content.ContentTypeReader`1[T].Read (Microsoft.Xna.Framework.Content.ContentReader input, System.Object existingInstance) [0x00003] in <14285e7be6444bda94a4048e3cb68e5b>:0
at Microsoft.Xna.Framework.Content.ContentReader.InnerReadObject[T] (T existingInstance) [0x0002d] in <14285e7be6444bda94a4048e3cb68e5b>:0
at Microsoft.Xna.Framework.Content.ContentReader.ReadObject[T] () [0x00000] in <14285e7be6444bda94a4048e3cb68e5b>:0
at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T] () [0x00006] in <14285e7be6444bda94a4048e3cb68e5b>:0
at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T] (System.String assetName, System.Action`1[T] recordDisposableObject) [0x00080] in <14285e7be6444bda94a4048e3cb68e5b>:0
at Microsoft.Xna.Framework.Content.ContentManager.Load[T] (System.String assetName) [0x0005a] in <14285e7be6444bda94a4048e3cb68e5b>:0
at ArbitraryPixel.Common.ContentManagement.MonoGame.MonoGameContentManager.Load[T] (System.String assetName) [0x00001] in C:\ArbitraryPixel\Libraries\ArbitraryPixel.Common\ArbitraryPixel.Common.ContentManagement.MonoGame\MonoGameContentManager.cs:30
at ArbitraryPixel.Common.Graphics.MonoGame.Factory.MonoGameEffectFactory.Create (ArbitraryPixel.Common.ContentManagement.IContentManager contentManager, System.String assetName) [0x00001] in C:\ArbitraryPixel\Libraries\ArbitraryPixel.Common\ArbitraryPixel.Common.Graphics.MonoGame\Factory\MonoGameEffectFactory.cs:11
at ArbitraryPixel.CodeLogic.Common.Scenes.MainMenuScene.OnLoadAssetBank (ArbitraryPixel.Common.ContentManagement.IContentManager content, ArbitraryPixel.Platform2D.Assets.IAssetBank bank) [0x00458] in C:\ArbitraryPixel\Code Logic\source\CodeLogic\ArbitraryPixel.CodeLogic.Common\Scenes\MainMenuScene.cs:136
This happens for Android only. The Windows build works fine.
I did some googling and the only thing I can find in relation to this is stuff having to do with MonoGame.Extended. I did have this in one of my base libraries, but removed it to see if it resolved the issue.
The strange thing is, if I make a brand new Android project and use the same shader, everything works fine. I'm currently using the latest released version of MonoGame (22.214.171.124), as well as the most up to date PCL versions from NuGet for all my portable libraries.
Both my game and my test project are targeting Android 9.0 for their build. In my game, I do have a a shared content folder loaded by both Windows and Android, referenced by a linked directory. In my test project it's just a full Android project. For my game, I did a full clean (and manual delete) of all bin/obj files, including all copied XNB files, so a previous version of a content build should not be present.
Has anybody encountered this before, or have any thoughts?