Locating App_Data in web apps
Posted on 2010-09-03
I recently switched to using the new Visual Studio 2010 for developing apps. Things mostly went smoothly. However, there's one issue I haven't be able to resolve.
In the past, Visual Studio put the App_Data in the root of the web app directory structure (matching the project layout). However, Visual Studio 2010 moves it under the bin directory when I publish the web app. So my code that references files in App_Data that works fine in testing is suddenly broken when I publish the web app. To deal with this I've just been copying App_Data to the root and avoid using the 'delete files before publish' option when I don't need to (so I don't have to copy App_Data everytime a publish a web app).
So my questions, is there a way to define a path that works in both development and live environments? Or is there a way to tell Visual Studio to publish App_Data to the root? Or should I be doing something different?