我有一个相当复杂的Visual Studio解决方案(2010年,但这不重要),我需要重命名。
我想重命名文件夹以匹配新的解决方案名称,但我无法找到自动重构文件夹名称的方法,而且查看每个项目文件将是一件痛苦的事情。
有官方的做法吗?
我有一个相当复杂的Visual Studio解决方案(2010年,但这不重要),我需要重命名。
我想重命名文件夹以匹配新的解决方案名称,但我无法找到自动重构文件夹名称的方法,而且查看每个项目文件将是一件痛苦的事情。
有官方的做法吗?
当前回答
重命名网站:
http://www.c-sharpcorner.com/Blogs/46334/rename-website-project-in-visual-studio-2013.aspx
定位并编辑IISExpress的applicationhost。配置,在这里找到: C: \用户{username} \ \ IISExpress \ config文件
其他回答
如果在加载Xamarin等共享项目时遇到问题,请记住在csproj文件中更改对共享库的引用。我开发了一款CocosSharp游戏,但Droid/iOS/WP81项目不想加载。我不得不在每个csproj文件(Driod/iOS/WP81)中更改下面的行,其中引用了共享库。这是由于文件夹名称更改造成的,因此将YOUR_PREVIOUS_NAMESPACE替换为文件夹的新名称。
<Import Project="..\YOUR_PREVIOUS_NAMESPACE.Shared\EmptyProject.Shared.projitems" Label="Shared" />
另外,我注意到对于. driod项目,项目属性中的程序集名称不能使用Visual Studio更改(我使用2015年)。我必须在. droid中手动更改程序集名称。csproj文件。
<AssemblyName>YourNameSpace</AssemblyName>
然后我加载解决方案,在项目属性视图新名称出现。重建dll后生成该名称。
您可以:
点击file-> new ->从现有项目创建项目 选择您的原始文件,例如。方案1,并输入新的文件名方案2 2 .在新方案中修改项目名称
下面是在Visual Studio 2013中逐步重命名整个解决方案的方法
假设我们正在更改一个名为“HelloWorld”的项目。到Section1to5.ui
转到解决方案资源管理器(截图如下),右键单击您希望重命名的项目,并选择“重命名”。输入所需的新名称。
Right click on the Project that you have just renamed, and click on "Properties". Under the Application tab, change the "Assembly name" and "Default namespace". In the main Program.cs file (or any other code files that you may have created), rename the namespace declaration to use the new name. For this right-click the namespace and select Refactor > Rename enter a new name. For example: namespace HelloWorld.ui ----> namespace Section1to5.ui Next, expand the "Properties" and double click on AssemblyInfo.cs file. You will notice the below code fragment:
[组装:AssemblyTitle(“HelloWorld.ui”)] [组装:AssemblyDescription (" ")) [组装:AssemblyConfiguration (" ")) [组装:AssemblyCompany(“微软”)] [组装:AssemblyProduct(“HelloWorld.ui”)] [assembly: AssemblyCopyright("Copyright©Microsoft 2015")] [组装:AssemblyTrademark (" ")) [组装:AssemblyCulture (" "))
您需要将Properties/AssemblyInfo.cs中的AssemblyTitle和AssemblyProduct更改为新名称,在本例中为“HelloWorld”。“Section1to5.ui”。更改完名称后,保存并关闭Visual Studio。
在项目目录中,进入“HelloWorld”文件夹。删除bin和obj目录。 完成后,将文件夹重命名为“HelloWorld”。到新的项目名称。 用文本编辑器(如Notepad或notepad++)打开重命名的解决方案文件,并编辑以下行: Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld. "ui”、“HelloWorld.ui \ HelloWorld.ui。csproj”、“{39 fc65a3 - 3 - ae7 4 - ec9 b8f7 - 74 f971636c70}”
替换“HelloWorld”的所有实例。你为你的项目选择的新名称,在本例中是“Section1to5.ui”。这将把项目的路径更改为步骤6中重命名的目录。
使用visual studio打开解决方案文件,并清理和重建项目。 您可能注意到“调试/运行”按钮已被“附加”按钮所取代。如果发生这种情况,只需右键单击项目并选择“设置为启动项目”选项。或者单击“工具>自定义>命令>添加命令>调试”,添加按钮。
你完成了重命名项目,如果你有任何疑问,请随时发帖,我很乐意帮助你!
如果您正在Visual Studio 2010中创建网站。您可以按照如下方式修改项目名称。
步骤1:在Visual Studio 2010中,SLN文件将存储在Visual Studio 2010的项目文件夹下,源文件存储在Visual Studio 2010的网站文件夹下。
步骤2:重命名文件夹右键单击该文件夹通过重命名,其中包含您的SLN项目。
步骤3:重命名SLN文件名右键单击该SLN文件转发重命名。
第四步:在Visual Studio 2010的Website下重命名包含SLN文件Source的文件夹。
步骤5:然后最后双击您的SLN文件,并更改您的SLN源文件夹的根。
The Rename operations in Visual Studio only change the filename, i.e. *.prj for a project, and *.sln for a solution. You will need to rename folders separately using the filesystem, and you will need to remove and re-add the projects since they will have new folder names. However, note that the solution and project files are respectively text and xml files. You could write your own program that parses them and renames both the folder names, filenames, and fixes the project/solution files internally.