CodeConverter icon indicating copy to clipboard operation
CodeConverter copied to clipboard

VB => C#: Rename 'My Project' folder to Properties

Open ATECoder opened this issue 5 years ago • 3 comments

Is your feature request related to a problem? Please describe. Consmetics

Describe the solution you'd like After convetion, I rename the My Project folder to Properties, which attains the characteristics of a C# project.

Describe alternatives you've considered N/A

Additional context N/A

ATECoder avatar Oct 23 '20 13:10 ATECoder

Seems reasonable to me!

It may be as simple as updating the target path here: https://github.com/icsharpcode/CodeConverter/blob/29deb717749836f5d2c2d733e81fe08761df6251/CodeConverter/CSharp/VBToCSProjectContentsConverter.cs#L82-L85

GrahamTheCoder avatar Oct 24 '20 09:10 GrahamTheCoder

I had a bit of a stab at this by replacing "My Project" with "Properties" in the target paths generated by the suggested function.

For the most part it had the intended effect, in that most files which would have been placed into "My Project" are instead placed into a new "Properties" directory, and the project properties window of visual studio finds the assembly version, copyright info etc.

However in my tests there were 2 files referenced in the .csproj file which remained in "My Project" and were not included in the list of documents to convert, hence never had the path replacement made. These were:

  • Application.myapp
  • Settings.settings

Not sure what else needs to change to make these "None" type items in the project also have their source/target paths considered and renamed. Perhaps something similar to how the WinForms "Resources.resx" files are added to the project as "Additional" documents?

jconnop avatar Feb 02 '21 03:02 jconnop

Yes I think adding them as additional documents (like resx) would be the correct thing to do. There isn't any other existing way to track non-code files, so if it isn't sufficient, that's the functionality we'd expand. It may be that there's a library call we can make to find these files, but I seem to remember struggling to find one. Looking in the directory itself might be easier than getting it from the project file sadly.

GrahamTheCoder avatar Feb 02 '21 12:02 GrahamTheCoder