# Why can't my .exe find my .fx file?

I'm having a problem with my .fx file in my D3D 11 application.

I can run the application just fine from Visual Studio, but when I run the .exe it fails when trying to load the .fx file.

I've checked the file name in the code and tried all sorts of paths but I can't figure this out, why is this happening?

• Try just the file name with nothing prepended, and put the file in the same directory as the exe. – aaaaaaaaaaaa Jan 3 '13 at 21:47
• A shot in the dark here, but if you are using VS2012 and your app has 'windows store support' selected, try right clicking your fx file, select properties, and verifying that 'Content' is set to yes. This gives VS the hint that it needs to be sent to the AppX folder during build along with the exe. – Steve H Mar 5 '13 at 13:13

This is likely due to a difference in the working directory for your program when run from Visual Studio versus launched "normally." Visual Studio sets the working directory for a process it launches. When you launch the executable normally, the working directory is the directory containing the executable itself.

Since relative paths begin at the working directory, this changes where you end up effectively looking for data files. Consider the following typical directory structure:

X/Projects/Game
Game.sln
Source/
Assets/
bin/
Debug/
Release/

robocopy $(ProjectDir)/Assets$(TargetDir) /S