One .hlsl to many .cso
01:27 16 Feb 2026

I have a shader with #define pre-processor variables. I would like to generate a shader for each "permutation" (really Cartesian product of the possible values the variables can take).

However, visual studio can't handle the following in the .vcxproj file

error : Cannot load project with duplicated project items: MyShader.hlsl is included as 'FxCompile' and as 'FxCompile' item types.

  
    USE_X=1
    MyShader_USEX.cso
  

  
    USE_Y=1
    MyShader_USEY.cso
  

  
    USE_X=1;USE_Y=1;USE_Z=1
    MyShader_XYZ.cso
  

https://developercommunity.visualstudio.com/t/cannot-load-project-with-duplicated-project-items/234871

visual-studio msbuild hlsl