简体   繁体   English

如何在Visual Studio扩展中重命名嵌套文件

[英]How to rename a nested file in visual studio extension

I have nested files like this 我有这样的嵌套文件

在此处输入图片说明

If i want to rename the file "Class1.v7_1_1.cs", I didn't get the rename option in visual studio. 如果我想重命名文件“ Class1.v7_1_1.cs”,则在Visual Studio中没有重命名选项。 So either i need to manually edit the proj file or do a custom extension. 因此,要么我需要手动编辑proj文件,要么做一个自定义扩展名。

In case of custom extension how to give rename facility like this 在自定义扩展的情况下,如何赋予这样的重命名功能

在此处输入图片说明

and rename the file ? 并重命名文件?

I need to develop a custom extension which should do renaming as just like how Visual Studio renames the other non-nested files. 我需要开发一个自定义扩展,该扩展应该像Visual Studio重命名其他非嵌套文件一样进行重命名。

My Solution 我的解决方案

My current solution is showing a window on right click of the selected file which needs to be renamed. 我当前的解决方案是在需要重命名的所选文件的右键单击上显示一个窗口。 In the window let the user enters the new file name and do the file renaming in the extension. 在窗口中,让用户输入新文件名并在扩展名中重命名文件。 But I don't know how to do the inline renaming as shown above. 但我不知道如何进行内联重命名,如上所示。

Please help me this regard. 请帮我这方面。 Thanks in advance. 提前致谢。

Edit the project file directly. 直接编辑项目文件。

Search for 搜索

<Compile Include="Class1.v7_1_1.cs">

and correct it to 并将其更正为

<Compile Include="Class1.v7_1_1.cs">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM