Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently learning SlimDX, I want to load a Shader from tutorial which is named "triangle.fx" and it is in a folder called "FX",everything is in my solution. When I'm typing this line of code:

 using (var bytecode = ShaderBytecode.CompileFromFile(@"FX/triangle.fx", "PShader", "ps_4_0", ShaderFlags.None, EffectFlags.None))

I'm getting FileNotFoundException, and I don't know why because everything exists in my solution.

share|improve this question
    
I'm learning from tutorials from the homepage of Slimdx. Even when I'm downloading the sample solution from the website, I'm getting the same error :( – user78174 Jan 25 at 17:14
    
Are your files being copied to the build target? – RobStone Jan 26 at 13:40
    
@RobStone, well I've just added a folder called "FX", then I have created a file called triangle.txt (because VS doesnt have any function for creating them), and I have changed it's extension to *.fx – user78174 Jan 26 at 18:43
    
The FX folder is in the same directory as the built .exe? – RobStone Jan 26 at 18:44
    
@RobStone The .exe file is in bin/Debug/ And the FX folder is in the MySlimDXProject3 folder,same as bin folder – user78174 Jan 26 at 18:50
up vote 0 down vote accepted

Make sure the FX folder is a subdirectory of the folder containing the .exe. In this case /bin/debug/FX

share|improve this answer
    
But in the sample from slimdx.org it isn't. This sounds silly. – user78174 Jan 26 at 19:48
    
That project is likely set to copy the folder when it builds – RobStone Jan 26 at 19:49
    
Wow,It worked, thank you kindly :). By the way, you said that the project from slimdx.org is "set to copy the folder when it builds", how can I do the same with mine ? – user78174 Jan 26 at 19:52
    
You should be able to right click the folder in the solution explorer to change build actions. The option you want might be content, though I can't recall it from my mobile. – RobStone Jan 26 at 19:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.