ceciliasharp / Extension.FolderToSolutionFolder

Visual Studio "15" extension
Apache License 2.0
32 stars 12 forks source link

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

Open tobias-loew opened 3 years ago

tobias-loew commented 3 years ago

Hi,

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

Please have a look at it.

tobias-loew commented 3 years ago

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 commented 3 years ago

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

tobias-loew commented 3 years ago

Ok, thanks!

Am 2021-03-13 11:11, schrieb Cecilia Wirén:

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

-- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub [1], or unsubscribe [2].

Links:

[1] https://github.com/ceciliasharp/Extension.FolderToSolutionFolder/pull/13#issuecomment-798086746 [2] https://github.com/notifications/unsubscribe-auth/ACCX7W5TBBNILR5SS5DGQVTTDM247ANCNFSM4ZARQYBA

ceciliasharp commented 3 years ago

@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 commented 3 years ago

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

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 )