The output from fxc is subtly different to the output of the effect compiler in XNA. I cannot remember the exact details - but I believe that there are differences in the file header - something about enumerating the effect parameters, I think.
The solution, then, is to use the effect compiler that comes with XNA's content pipeline, in place of fxc. The class you need is Microsoft.Xna.Framework.Content.Pipeline.Processors.EffectProcessor.
Here is an example of how to use it. You can put this into a simple command-line project:
string fx = File.ReadAllText("Effect1.fx");
EffectProcessor effectProcessor = new EffectProcessor();
var effect = effectProcessor.Process(new EffectContent { EffectCode = fx }, new MyContext());
byte[] yourEffectCode = effect.GetEffectCode();
Note that you need a context class, derived from ContentProcessorContext. There are lots of methods you need to override, but only three are required to actually do anything for the above code to work:
class MyContext : ContentProcessorContext
{
public override string BuildConfiguration { get { return ""; } }
public override TargetPlatform TargetPlatform { get { return TargetPlatform.Windows; } }
public override GraphicsProfile TargetProfile { get { return GraphicsProfile.HiDef; } }
// ... other overrides ...
}
Note that (as well as Microsoft.Xna.Framework.Graphics.dll) this requires that your project references Microsoft.Xna.Framework.Content.Pipeline.dll. This requires that you project is built against the full .NET 4.0 framework (not the "Client Profile"). Also this content pipeline DLL is not redistributable (but then I'm not sure fxc is either).