# Error trying to compile HLSL "FXC : error X3506: unrecognized compiler target 'vs'"

**URL:** https://discourse.cmake.org/t/error-trying-to-compile-hlsl-fxc-error-x3506-unrecognized-compiler-target-vs/12805
**Category:** Code
**Tags:** gen:vs
**Created:** [October 20, 2024, 12:57pm UTC](https://discourse.cmake.org/t/error-trying-to-compile-hlsl-fxc-error-x3506-unrecognized-compiler-target-vs/12805 "2024-10-20T12:57:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Wallby](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/w/4491bb/32.png) [@Wallby](https://discourse.cmake.org/u/Wallby)
#### Post date: [October 20, 2024, 12:57pm UTC](https://discourse.cmake.org/t/error-trying-to-compile-hlsl-fxc-error-x3506-unrecognized-compiler-target-vs/12805/1 "2024-10-20T12:57:54Z")

</div>

I added the following in my CMakeLists.txt…

```auto
set(PATH_PER_VERTEXSHADER ${VERTEXSHADERS})
set(PATH_PER_PIXELSHADER ${PIXELSHADERS})
list(TRANSFORM PATH_PER_PIXELSHADER PREPEND Source/)
list(TRANSFORM PATH_PER_VERTEXSHADER PREPEND Source/)
set(PATH_PER_SHADER ${PATH_PER_VERTEXSHADER} ${PATH_PER_PIXELSHADER})
set_property(SOURCE ${PATH_PER_VERTEXSHADER} PROPERTY VS_SHADER_TYPE vertex)
set_property(SOURCE ${PATH_PER_VERTEXSHADER} PROPERTY VS_SHADER_MODEL 5.0)
set_property(SOURCE ${PATH_PER_PIXELSHADER} PROPERTY VS_SHADER_TYPE pixel)
set_property(SOURCE ${PATH_PER_PIXELSHADER} PROPERTY VS_SHADER_MODEL 5.0)
add_library(TestShaders INTERFACE ${PATH_PER_SHADER})

```

Running `cmake --build .cmake --config Debug` the following error happens…

> FXC : error X3506: unrecognized compiler target ‘vs’

There seems to be no documentation about what to specify for VS\_SHADER\_TYPE and VS\_SHADER\_MODEL, I experimented until something caused the output to change, and ended up with these parameters… `vertex` and `shader` for VS\_SHADER\_MODEL, and for VS\_SHADER\_TYPE a dot (e.g. `5.0` instead of `5_0`)

CMake version is 3.30.5

---

<div class="post-metadata">

### Author: ![Wallby](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/w/4491bb/32.png) [@Wallby](https://discourse.cmake.org/u/Wallby)
#### Post date: [October 20, 2024, 1:02pm UTC](https://discourse.cmake.org/t/error-trying-to-compile-hlsl-fxc-error-x3506-unrecognized-compiler-target-vs/12805/2 "2024-10-20T13:02:30Z")

</div>

Only post I found about a person seemed getting the same error (but different output) is this one..  
[When compile HLSL shader model5.1, get error X3506: unrecognized compiler target ‘vs\_5\_1’ - Microsoft Q&A](https://learn.microsoft.com/en-us/answers/questions/321517/when-compile-hlsl-shader-model5-1-get-error-x3506?childtoview=321760)

If it is supposed to output a full profile string (vs\_5\_11), then maybe that is the issue?

# References

1: [Syntax - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/direct3dtools/dx-graphics-tools-fxc-syntax#profiles)

---

<div class="post-metadata">

### Author: ![Wallby](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/w/4491bb/32.png) [@Wallby](https://discourse.cmake.org/u/Wallby)
#### Post date: [October 20, 2024, 1:07pm UTC](https://discourse.cmake.org/t/error-trying-to-compile-hlsl-fxc-error-x3506-unrecognized-compiler-target-vs/12805/3 "2024-10-20T13:07:09Z")

</div>

Found some screenshots of what type and model in Visual Studio look like…  
[How to compile hlsl shader file in Visual Studio C# project - Stack Overflow](https://stackoverflow.com/questions/37301923/how-to-compile-hlsl-shader-file-in-visual-studio-c-sharp-project)  
[visual studio 2013 - VS2013: Compiling Shaders with Shader Model 5.0 - Stack Overflow](https://stackoverflow.com/questions/28091294/vs2013-compiling-shaders-with-shader-model-5-0)  
But trying to specify type /vs causes an error…

> error : Element has an invalid value of “/vs”.

And specifying /5\_0 for the model causes an error…

> error : Element has an invalid value of “/5\_0”.
