我有一个相当复杂的Visual Studio解决方案(2010年,但这不重要),我需要重命名。

我想重命名文件夹以匹配新的解决方案名称,但我无法找到自动重构文件夹名称的方法,而且查看每个项目文件将是一件痛苦的事情。

有官方的做法吗?


当前回答

如果在加载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后生成该名称。

其他回答

如果要重命名解决方案,可以执行以下步骤。

Backup.First things first, make sure to always create a backup file.Simply copy your project to a different directory. In Solution Explorer, right-click the project, select Rename, and enter a new name. In Solution Explorer, right-click the project and select Properties. On the Application tab, change the "Assembly name" and "Default namespace". Open any .cs and rename all namespace Change the AssemblyTitle and AssemblyProduct in Properties/AssemblyInfo.cs. Delete bin and obj directories physically. Rename the project physical folder directory. Open the Sln file (within notepad or any editor) and change the path to the project. Cleans and Rebuild the project

https://learn.microsoft.com/en-us/answers/questions/1028483/rename-solution-and-related-projects-in-a-aspnet-w.html细节……

如果您正在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源文件夹的根。

如果在加载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 .在新方案中修改项目名称

重命名一个解决方案:

In Solution Explorer, right-click the project, select Rename, and enter a new name. In Solution Explorer, right-click the project and select Properties. On the Application tab, change the "Assembly name" and "Default namespace". In the main cs file (or any other code files), 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 WindowsFormsApplication1 Change the AssemblyTitle and AssemblyProduct in Properties/AssemblyInfo.cs. [assembly: AssemblyTitle("New Name Here")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("New Name Here")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] Delete bin and obj directories physically. Rename the project physical folder directory. Open the SLN file (within notepad or any editor) and change the path to the project. Clean and Rebuild the project.