I'm trying to build pixel shader in a C# class library.
I have added fx file to the project. Since I can't find any suitable build action I tried to manually edit csproj:
<FxCompile Include="MyEffect.fx">
<ShaderType>Pixel</ShaderType>
</FxCompile>
but when I try to locate the ps file, I get System.IO.IOException: Cannot locate resource 'MyEffect.ps'
here is the code that throws error:
public class MyEffect : ShaderEffect
{
public MyEffect(){
this.PixesShader = new Uri("pack://application:,,,/WpfControlLibrary1;component/MyEffect.ps");
}
}
How to setup my project so that I can locate the compiled shader?
All the tutorials I have found are for C++ projects or deals with old tools like custom build task, but I think that is not required since VS2012.
EDIT: Visual Studio does compile .fx files only in C++ projects. In C# projects it does not work. It is mentioneded here: http://blogs.msdn.com/b/chuckw/archive/2012/05/07/hlsl-fxc-and-d3dcompile.aspx