Jump to content
  • Advertisement
Sign in to follow this  
Gavin Williams

MS have released a nuget pkg to compile hlsl inside a c# project.

This topic is 894 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In case you missed it, I certainly did, Microsoft released a nuget package at the end of last year that allows hlsl files to be compiled inside your C# projects. Previously, the only solutions (at least for smaller devs such as myself) were to either :

1) Add a C++ project to your solution and compile them there.
2) Run fxc on the command line.
3) Build a dynamic compilation system using d3dcompiler.

Now, with version 1.0.1 of the Microsoft.HLSL.CSharpVB nuget pkg you will have the option of setting the build action for your hlsl files in the properties panel of Visual Studio, no further nonsense required. The following build actions are supported :


And some of the most used options are configurable in the properties panel such as /Od and /Zi. And as of the recent update, the various shader models are selectable (2.0 to 5.1).

I've wanted this for a long time. And although I think it should just be built in to Visual Studio, this is a step in the right direction.

Edit : If you have an issue with an unrecognized character at the start of your file when trying to build, the encoding is wrong. Normally I would use Notepad++ to change the encoding, but if that doesn't work, use Advanced Save Options in Visual Studio and change the encoding to Unicode (UTF-8 without signature) and leave Line endings: Current Setting.

Edited by Gavin Williams

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!