0

I am new to Visual Studio, and I am trying to figure out the best way to organize my projects.

I am writing an application using the sfml library, and I have various resources (images/sounds) that I am using. I dropped these into the project folder, and everything works fine when I launch my application from Visual Studio.

I am wondering though, how does this translate to when a program is deployed? If I go into my solution's debug folder, and try launching the exe, it is unable to locate any of the resource files. Am I suppose to tell Visual Studio to copy files to an appropriate directory, and if so how?

Thanks for any advice or links.

zrbecker
  • 1,394
  • 1
  • 19
  • 39

2 Answers2

2

For slightly more complicated "deployment" scenario, you can use post-build scripts to copy the correct files into the output directory and even package it into a zip file, for example.

If you find yourself writing more than one page of batch you may want to consider the options below, because batch is a PITA to debug.

Recent MSVS project files are actually MSBuild files (just open the .vcxproj file in Notepad or Vim). For instance you can use the Copy task, invoke arbitrary programs using the Exec task, etc. It can be a bit more sophisticated than the batch script in post-build scripts. MSBuild 4 can use Property Functions making it quite expressive. Useful reference if you do this

For a "full blown" project, you'll want to roll a dedicated build system using a dedicated MSBuild file, NAnt or even higher level wrappers like Rake.

As a less popular alternative, in a previous project I built a small dedicated "builder" .exe project in the solution and have other projects depend on it. Then in the post-build scripts of the other projects I just invoke the builder projects with arguments to make it perform certain tasks. The advantage is that you can write C# (or F# or VB.NET) and not have to fight the build system (as much) and I think it works quite well for small-mid sized projects.

Community
  • 1
  • 1
kizzx2
  • 18,775
  • 14
  • 76
  • 83
1

for my project, I direct everything into one directory.
Go to ur project configuration, change General->Output directory, General->intermediate directory, and Debugging->Working directory to one directory. The reason you cannot locate the resource files is because the debug directory is not the same as the output directory.

yngccc
  • 5,594
  • 2
  • 23
  • 33
  • Ah I see. Do you have the debug and release configurations put their files in the same location? – zrbecker May 09 '13 at 03:52
  • no, if you look at the top left side of the property page, there is different configuration for debug and release build. – yngccc May 09 '13 at 03:54