views:

56

answers:

2

I have a C# Solution that includes several websites. Those websites have some communal data (e.g. images and shared jQuery extensions). Currently the data is included in each Project. Obviously we're running into sync problems and as those data directories are becoming larger, we're moving more and more data around. We could hard encode links to where the data really resides on the production server but I think we'd like to avoid that (not to mention that we use the embedded cassini server for our testing and such and I've no idea how smoothly that would work). Is there something I've overlooked for a portable and maintainable way to do this?

Clarification: The contents that needs to be shared are located in directories (i.e. images/, js/)

+4  A: 

You can add those files to the project as linked files - that way they are not physically copied into the project's directory but are still included in the project. You can just worry about maintaining one folder's worth of static content and know that whenever you build your solutions you will be using the version from that folder.

To add a linked file in Visual Studio, right click the project, hit add->existing file, then in the select file dialog hit the little drop down arrow next to the "add" button and pick "Add as link".

Chris Clark
this is so very close, but apparently you can't add a folder as a link. I added a clarification to the question. Sorry.
OldTroll
Do you need every file from that folder in every project? If not then just include the ones you need for that specific project.Would you reconsider keeping the files outside of the project and using links in the pages? You said you wanted to avoid doing this because the paths may differ between production and development, but if you use something like asp.net's Page.ResolveUrl() you should be able to address that issue. Plus that will work if you ever change your app to use routing tables or otherwise change your directory structure.
Chris Clark
+1  A: 

Quickest solution would be to create virtual directories on your production server to point to a single location of your data directories.

This would mimic including the data directories in your various solutions.

Filburt

related questions