This tangled web (of documentation) we weave.

tangleWhilst being involved in a handover of knowledge for a colleague who was leaving the company I realised that the documentation for a lot of the affected projects resided all over our internal  network and was in use by more than one department. Faced with the prospect of NOT being able to just move these items into a central repository (yet) and not wanting more than one copy internally I decided to use visual studio to add links to these documents. Unfortunately there are LOTS of these files and so I decided that I would prefer to use the filing system itself to categorise them(as someone has already put time and effort into this). I thus decided to add the entire directory as a link in my documentation project which I always create for every solution…..

This was where my issues started, the visual studio ui does not support adding whole directories so I decided that, with one eye on the past, that I bet the project file does support it but the ui doesn’t. A quick scan of the internet revealed this to be the case. After a little jiggery pokery I found that the following XML added to a project file would enable me to achieve this:-

<ItemGroup>
<Folder Include=”Documents\” />
</ItemGroup>
<ItemGroup>
<None Include = “\\myServer\designdocs\**\*.*”>
<Link>Documents\%(RecursiveDir)%(filename)</Link>
</None>
</ItemGroup>

This small snippet creates a parent node called ‘Documents’ and creates links for each file\folder within the ‘designdocs’ directory inside my documentation project. Because I have specified %(RecursiveDir) the documents  also appear linked within their source folders rather than being shown flat underneath my ‘Documents’ folder so for instance a file residing in the \\myServer\designdocs\TestFiles source directory is displayed within the ‘Documents\TestFiles’ folder inside my visual studio project.

A couple of asides  can also be mentioned:-

  1. The (*.*) mask utilised within <None> tag also allows you to filter the files that are returned so you may include only *.cs file etc
  2. Instead of using the <None> tag you may elect to use the <Compile> tag to include source files that may be imported and compiled etc.

I’ve only scratched the surface here of what is possible but hopefully this will help somebody else who needs to work outside the confines of what is seemingly possible.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s