Adding a folder and a file to a project

As I understand it there is a limitation in the Resharper API in that it throws a deliberate error if you try to use it's CreateFolder method, and instead the recommendation was to drop out to the VS EnvDTE nastiness to do what you need as per another post on this forum I saw.


I have done something similar to that, but I have a few issues which I would greatly appreciate any help with...

1. I can't find a way to force Resharper to resynchronise immediately it's IProject object with the changes made via EnvDTE? i.e. After doing the EnvDTE.ProjectItems.AddFolder or .AddFromFile methods I can't then walk through the IProject.GetSubItems() etc of the "new directory" because it doesn't know about it?

2. If I then using the VS IDE to "exclude" frmo the project both that file and it's parent folder, I want the ability that if my original action is repeated that I can detect the file exists and "include" it programmatically. However when I try the Env DTE ProjectItems.AddFolder "trick" like I did when first creating the folder, I get a nasty error coming back from EnvDTE about "A file or folder with the name 'xxx' already exists on disk at this location. Please choose another name...". But I can' see any other way of "adding" a currently excluded file in a currently excluded folder to the project?

Many thanks,
Grant.

P.S. Your msi for 4.1 power toys is a bit messed up, missing files, directory paths not right etc. Took me ages to move and hack stuff around (including installing the 3.0 power toys as well for the missing files like the msbuild targets) to get something that would actually load.

0

Please sign in to leave a comment.