MSDN has an example of a custom HLSL effect importer and processor. Here is the importer's code:
public override PSSourceCode Import(string filename,
ContentImporterContext context)
{
string sourceCode = System.IO.File.ReadAllText(filename);
return new PSSourceCode(sourceCode, System.IO.Path.GetFileNameWithoutExtension(filename));
}
In the processor they do this:
EffectContent effectSource = new EffectContent();
effectSource.EffectCode = input.SourceCode;
EffectProcessor processor = new EffectProcessor();
compiledEffect = processor.Process(effectSource, context);
The sample works okay, however, when you try to import and process an effect file that has #include "otherEffect.fx"
directive in it, the build process throws an error "Failed to open source file 'otherEffect.fx'". I presume that is because the relative path of the file is not specified correctly but I don't know where to specify it. Does anyne know this?