[英]how to best change directory structure (of sln and projects) in a c# project
I'm working on ac# project, lately we decided to restructure the directories structure of the source code. 我正在研究ac #project,最近我们决定重构源代码的目录结构。 I'm doing the restructure and wanted to ask you some questions about what is the best way to conduct the change.
我正在进行重组,并想问你一些关于进行变革的最佳方法的问题。 The restructure is basically changing the current directories of all the projects to a more structured and logical order.
重组基本上是将所有项目的当前目录更改为更结构化和逻辑顺序。
The current structure is (this is a scheme): 目前的结构是(这是一个方案):
Main Dir: 主要目录:
The Target scheme is: TFS Project: Main - Source - Dir - Solution file. 目标方案是:TFS项目:主要 - 来源 - 目录 - 解决方案文件。 - Project - Project - Project - Project
- 项目 - 项目 - 项目 - 项目
- Dir
- Dir
- Project
- Project
- Project
- Dir
- Solution file.
- Dir
- Project
- Project
The relative location between the projects is changed and also the relative locations in the solutions. 项目之间的相对位置以及解决方案中的相对位置也会发生变化。
The question is how to make change in the best manner: - How to Fix all the references of each project? 问题是如何以最佳方式进行更改: - 如何修复每个项目的所有参考? - How to fix all the solutions?
- 如何解决所有解决方案? - Is there any tool available for that?
- 有没有可用的工具?
If using option 2:
如果使用选项2:
Move your non csproj/sln files to their target locations, make sure you understand the relative changes in your paths.
将非csproj / sln文件移动到其目标位置,确保您了解路径中的相对更改。
A couple of additions: 几个补充:
I am not aware of any tools that exist to automatically do this, but I do know of two options that you have, option 1 is to use VS to do the refactor (longer) or option 2 is to use something like powershell (or your favorite scripting language) to update the sln and csproj references. 我不知道有任何工具可以自动执行此操作,但我知道您有两个选项,选项1是使用VS来执行重构(更长)或选项2是使用类似PowerShell(或者您的最喜欢的脚本语言)来更新sln和csproj引用。
If you are using option 1: 如果您使用选项1:
If using option 2: 如果使用选项2:
Unfortunately it will be pretty manual, and pretty error prone. 不幸的是,它将非常手动,并且非常容易出错。 I recommend option #1, and have just gotten done doing it on a project with 100+ csproj and 30 sln files.
我推荐选项#1,并且刚刚完成了一个包含100多个csproj和30个sln文件的项目。 There were about 4000 source files, which I moved by hand and then used find replace in vs studio (with the project unloaded) to update.
大约有4000个源文件,我手动移动然后在vs studio中使用find replace(项目已卸载)进行更新。
Good luck. 祝好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.