Skip to content

added adding Folders to project, replaces BrowseForFoldersDialog by CommonOpenFileDialog#13

Open
tobias-loew wants to merge 6 commits intoceciliasharp:masterfrom
tobias-loew:master
Open

added adding Folders to project, replaces BrowseForFoldersDialog by CommonOpenFileDialog#13
tobias-loew wants to merge 6 commits intoceciliasharp:masterfrom
tobias-loew:master

Conversation

@tobias-loew
Copy link

Hi,

I've implemented adding folders to projects/project-filters (only for virtual folder).

Please have a look at it.

replaces BrowseForFoldersDialog by CommonOpenFileDialog
added status messages
fixed adding to solution-folder
@tobias-loew
Copy link
Author

Hi,
since I'm not sure whether this project is actively maintained, and I think the changes in this PR are really useful for the community, I'll wait two more days for a reaction, otherwise I will revoke it and publish a new VS-Extension.
Tobias

@ceciliasharp
Copy link
Owner

I will have look at this as soon as possible, have patience.

@tobias-loew
Copy link
Author

tobias-loew commented Mar 13, 2021 via email

no bakup files need
no backup files needed
@ceciliasharp
Copy link
Owner

@tobias-loew I have tried your changes out now and they will be a good addition to the extension. But would like to have an other name for the folder add just to clarify that it will add the files as liked file not actually add them. Can 'add folder as linked files' work or will that be too confusing you think? the more correct description would be something like "add folder content as folder and link foldes files into them" but that is tooooooo long :-D

@tobias-loew
Copy link
Author

There is also to consider, that .net-projects and non-.net-projects (like C/C++) behave differently:

  • .net-projects add real folders: adding a folder to a .net-project will create the folder on disk (if it doesn't already exist), files are copied (if not already present)
  • non-.net-projects add virtual-folders: the added folder only exists in the VS-projects, files are just links

The code currently handles both transparently: it first tries to add virtual-folders. If that doesn't work it tries real-folders.
So, best would be some text describing both, or dynamically adjusted text depending on the project type.

@ceciliasharp
Copy link
Owner

I just tried it out on a console application .net 3.5 and the folders were created on disk but the files were not created just linked. (so not copied that you describe). nices way of handling this would be to catch what type of project it is and show the different menu options depending on that.

@tobias-loew
Copy link
Author

Of course, you're right: I didn't use the extension for testing file-insertion on .net-projects, but simply dragged one in from the explorer, which resulted in file-copying.
I checked the docu of ProjectItems (https://docs.microsoft.com/en-us/dotnet/api/envdte.projectitems?view=visualstudiosdk-2019): it has both Methods AddFromFile and AddFromFileCopy.
It seems that .net-projects should use AddFromFileCopy, non-.net-projects and the solutions-folders should use AddFromFile.

@tobias-loew
Copy link
Author

IMHO only the combinations (real-folder + AddFromFileCopy) and (virtual-folder + AddFromFile) make sense, as (real-folder + AddFromFile) will end up with a bunch of empty folders and for (virtual-folder + AddFromFileCopy) you don't know, what the base-folder is or you put all files in the same folder and end up with name-conflicts,

So, how to figure out if virtual or real folders should be added to a project: the list of different project-types is quite-long (as of 2016 https://www.codeproject.com/Reference/720512/List-of-Visual-Studio-Project-Type-GUIDs) and rather incomplete (at least Intel-Fortran-projects are missing, but I guess many more, plus there will be new ones), so it could be a two stage test: first looking for a registered project type, otherwise use the rootItems.AddFolder test (and that can be cached, even to the SettingsStore )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments