FXC : error X3501: 'main': entrypoint not found

The option below only works on Visual Studio 2012 or later version.

If you compile a .fx file, you can set the shader type to "fx" as below:

  1. Right click your project in VS and select properties

  2. Expand the HLSL compiler option, select "Effect(/fx)" for Shader Type, you can also specify a entry point function for Entrypoint Name.

enter image description here


rekotc answer is good, but in Microsoft DirectX examples https://github.com/Microsoft/DirectXTK, "configuration properties->general->Item Type->Does not participate in build" is used instead "configuration properties->general->excluded from build->yes". That also works.


since VS2012 microsoft decided to include a HLSL compiler (that's where the error comes from), but you don't need it since you are loading and compiling the .fx file at runtime using the D3DX11CompileFromFile() function. So just exclude the .fx file from the build, right-click on the file in the solution explorer and choose properties->configuration properties->general->excluded from build->yes.