ModernRonin / ProjectRenamer

Conveniently rename your csproj files
Other
155 stars 14 forks source link

Issue with Solution Folders That Start with `.` #24

Closed Mike-E-angelo closed 3 years ago

Mike-E-angelo commented 3 years ago

First off THANK YOU for creating this project! What a cool tool that really should be part of Visual Studio.

Everything works really well, especially the git aspect which was not something I was personally looking for but after using this I very much see why Git is a part of it.

That stated, I did run into an issue while running this on a SLN that has the target project in a solution folder that starts with ., for instance: Features/.shared

This is my output:

H:\Root>renameproject Starbeam.Features.Transactions Starbeam.Features.Transactions.Purchasing
Please review the following settings:
Project:                   Starbeam.Features.Transactions
found at:                  H:\Root\Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj
Rename to:                 Starbeam.Features.Transactions.Purchasing
at:                        H:\Root\Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj)
VS Solution folder:        Features/.shared
exclude:
Paket in use:              no
Run paket install:         yes
Run build after rename:    no
Create automatic commit:   yes
Git version:               git version 2.30.0.windows.2

-----------------------------------------------
Do you want to continue with the rename operation? [Enter=Yes, any other key=No]
Analyzing references in your projects - depending on the number of projects this can take a bit...
Project `Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj` removed from the solution.
Project reference `..\Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj` removed.
Project reference `..\Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj` removed.
Project reference `..\Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj` removed.
Project reference `..\Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj` removed.
Project reference `..\Starbeam.Features\Starbeam.Features.csproj` removed.
Reference `..\Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj` added to the project.
Reference `..\Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj` added to the project.
Reference `..\Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj` added to the project.
Reference `..\Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj` added to the project.
Reference `..\Starbeam.Features\Starbeam.Features.csproj` added to the project.
Project `Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj` added to the solution.
[temp 5d596c7] Renamed Starbeam.Features.Transactions to Starbeam.Features.Transactions.Purchasing
 11 files changed, 34 insertions(+), 35 deletions(-)
 rename {Starbeam.Features.Transactions => Starbeam.Features.Transactions.Purchasing}/Accounting/PerformAudit.cs (100%)
 rename {Starbeam.Features.Transactions => Starbeam.Features.Transactions.Purchasing}/Purchasing/DistributionValue.cs (100%)
 rename {Starbeam.Features.Transactions => Starbeam.Features.Transactions.Purchasing}/Purchasing/PurchaseOrderOwner.cs (100%)
 rename {Starbeam.Features.Transactions => Starbeam.Features.Transactions.Purchasing}/Registrations.cs (100%)
 rename Starbeam.Features.Transactions/Starbeam.Features.Transactions.csproj => Starbeam.Features.Transactions.Purchasing/Starbeam.Features.Transactions.Purchasing.csproj (100%)
 rename {Starbeam.Features.Transactions => Starbeam.Features.Transactions.Purchasing}/TransactionDetails.cs (100%)

But this is what I see in the solution explorer in Visual Studio:

In this case it was an easy fix as the .shared folder should be a root folder so I moved all the shared projects within there to simply Features, re-ran the command, and it worked (after deleting the folders from the previous attempt, that is).

However, I do have other folders that start with the . so this might be a problem in the future at some point without some fancy naming gymnastics. :)

Anyways, thank you for your efforts here!

ModernRonin commented 3 years ago

Hi Mike,

Lately I was kinda swamped with my bread-job, so I haven't been able to get round to try and repro and then fix the bug reports here.

However, I plan on spending the Easter Monday on finally catching up.

Thank you for your very detailed report, this is extremely helpful! And also for your kind words :-)

Let's see, hopefully next week I will have a fix for your and the other two issues :-)

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Mike-E @.> Sent: Friday, April 2, 2021 6:51:55 AM To: ModernRonin/ProjectRenamer @.> Cc: Subscribed @.***> Subject: [ModernRonin/ProjectRenamer] Issue with Solution Folders That Start with . (#24)

First off THANK YOU for creating this project! What a cool tool that really should be part of Visual Studio.

Everything works really well, especially the git aspect which was not something I was personally looking for but after using this I very much see why Git is a part of it.

That stated, I did run into an issue while running this on a SLN that has the target project in a solution folder that starts with ., for instance: Features/.shared

This is my output:

H:\Root>renameproject Starbeam.Features.Transactions Starbeam.Features.Transactions.Purchasing Please review the following settings: Project: Starbeam.Features.Transactions found at: H:\Root\Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj Rename to: Starbeam.Features.Transactions.Purchasing at: H:\Root\Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj) VS Solution folder: Features/.shared exclude: Paket in use: no Run paket install: yes Run build after rename: no Create automatic commit: yes Git version: git version 2.30.0.windows.2


Do you want to continue with the rename operation? [Enter=Yes, any other key=No] Analyzing references in your projects - depending on the number of projects this can take a bit... Project Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj removed from the solution. Project reference ..\Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj removed. Project reference ..\Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj removed. Project reference ..\Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj removed. Project reference ..\Starbeam.Features.Transactions\Starbeam.Features.Transactions.csproj removed. Project reference ..\Starbeam.Features\Starbeam.Features.csproj removed. Reference ..\Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj added to the project. Reference ..\Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj added to the project. Reference ..\Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj added to the project. Reference ..\Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj added to the project. Reference ..\Starbeam.Features\Starbeam.Features.csproj added to the project. Project Starbeam.Features.Transactions.Purchasing\Starbeam.Features.Transactions.Purchasing.csproj added to the solution. [temp 5d596c7] Renamed Starbeam.Features.Transactions to Starbeam.Features.Transactions.Purchasing 11 files changed, 34 insertions(+), 35 deletions(-) rename {Starbeam.Features.Transactions => Starbeam.Features.Transactions.Purchasing}/Accounting/PerformAudit.cs (100%) rename {Starbeam.Features.Transactions => Starbeam.Features.Transactions.Purchasing}/Purchasing/DistributionValue.cs (100%) rename {Starbeam.Features.Transactions => Starbeam.Features.Transactions.Purchasing}/Purchasing/PurchaseOrderOwner.cs (100%) rename {Starbeam.Features.Transactions => Starbeam.Features.Transactions.Purchasing}/Registrations.cs (100%) rename Starbeam.Features.Transactions/Starbeam.Features.Transactions.csproj => Starbeam.Features.Transactions.Purchasing/Starbeam.Features.Transactions.Purchasing.csproj (100%) rename {Starbeam.Features.Transactions => Starbeam.Features.Transactions.Purchasing}/TransactionDetails.cs (100%)

But this is what I see in the solution explorer in Visual Studio: [https://camo.githubusercontent.com/a4aa45e89c9859a9d93e67a180c2860c6f3f17b78c593930ccaf68014b7807be/68747470733a2f2f692e696d6775722e636f6d2f73306e355875432e706e67]https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcamo.githubusercontent.com%2Fa4aa45e89c9859a9d93e67a180c2860c6f3f17b78c593930ccaf68014b7807be%2F68747470733a2f2f692e696d6775722e636f6d2f73306e355875432e706e67&data=04%7C01%7C%7C3021603642ce411145c808d8f59b6ccc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637529395172925554%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ulAmKZdoFiGLV1UKou181ko7zd1opPMDIiwy1SW9O%2BE%3D&reserved=0

In this case it was an easy fix as the .shared folder should be a root folder so I moved all the shared projects within there to simply Features, re-ran the command, and it worked (after deleting the folders from the previous attempt, that is).

However, I do have other folders that start with the . so this might be a problem in the future at some point without some fancy naming gymnastics. :)

Anyways, thank you for your efforts here!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FModernRonin%2FProjectRenamer%2Fissues%2F24&data=04%7C01%7C%7C3021603642ce411145c808d8f59b6ccc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637529395172925554%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=tIWPO0JrMNUaeBFYdYW%2FnJz0linIMzuCVHG4Au%2BhMrU%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABYR4LS6UCYIIVEIPAVDF6TTGVLPXANCNFSM42IKMVEA&data=04%7C01%7C%7C3021603642ce411145c808d8f59b6ccc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637529395172935509%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=XJFjqpOGlQvAvmO6CrDTwmOeje18B6%2Bw5nmrXrOBCaQ%3D&reserved=0.

Mike-E-angelo commented 3 years ago

Great, thank you so much @ModernRonin! As an open-source maintainer myself I know how it goes. :)

BTW, not to pile on. 😁 But it does seem there are additional issues with SLN folders in general. I just tried on another project and it emitted the same folder twice with two different GUIDs:

Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Applications/Notifications", "Applications\Notifications", "{54265B85-C9C2-4A92-A3E5-BDB6D035188B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Starbeam.Applications.Notifications.Environment.Development", "Starbeam.Applications.Notifications.Environment.Development\Starbeam.Applications.Notifications.Environment.Development.csproj", "{22DE2737-51DA-4E05-89C5-AE0B31650182}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Applications/Notifications", "Applications\Notifications", "{4CCD491F-1B6E-494C-B47D-BA0A6E2634E0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Starbeam.Applications.Notifications.Environment", "Starbeam.Applications.Notifications.Environment\Starbeam.Applications.Notifications.Environment.csproj", "{CE3E64B9-42FA-4AB6-89C4-F81BBB1DBD19}"

I found this out on the next project I attempted to rename, the output was as follows:

Unhandled exception. Microsoft.Build.Exceptions.InvalidProjectFileException: SolutionParseDuplicateProject  H:\Root\Starbeam.sln
   at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
   at Microsoft.Build.Construction.SolutionFile.ParseSolution()
   at Microsoft.Build.Construction.SolutionFile.ParseSolutionFile()
   at Microsoft.Build.Construction.SolutionFile.Parse(String solutionFile)
   at ModernRonin.ProjectRenamer.Application.<>c__DisplayClass3_0.<Run>g__findProject|17() in C:\Projects\Github\ProjectRenaming\ModernRonin.ProjectRenamer\Application.cs:line 204
   at ModernRonin.ProjectRenamer.Application.Run() in C:\Projects\Github\ProjectRenaming\ModernRonin.ProjectRenamer\Application.cs:line 27
   at ModernRonin.ProjectRenamer.Program.Main(String[] args) in C:\Projects\Github\ProjectRenaming\ModernRonin.ProjectRenamer\Program.cs:line 92

Not sure if this is already captured here somewhere but wanted to mention it in case. I appreciate your efforts, no matter what! 👍

ModernRonin commented 3 years ago

just an update:

I have a good lead regarding the solution folder issue, but I can't finish this today. I'll try to continue tomorrow or the day after.

ModernRonin commented 3 years ago

I just pushed a new version that definitely fixes the original issue.

The reason really was the nesting of solution folders, not the leading period. I think this might also fix your other issue, but there I had too little detail to reproduce the behavior.

Please verify and let me know. If the second issue still happens, I will need a bit more info about the solution folder that's being duplicated, like it's name and the structure of projects inside. Thank you :-)

Mike-E-angelo commented 3 years ago

Awesome! Thank you @ModernRonin! FWIW I worked around this by putting the project in the root folder, renaming it there, and then putting it back into the original solution folder. I don't have any projects that need renaming ATM but for sure will keep an eye out and let you know of any success/issues I run into. Thanks again for your diligent work on this out there!