我想复制一份我的项目。我宁愿不从头开始添加文件和引用等。请注意,我指的不是用于部署的复制。只是简单的复制。

VS中有这样的工具吗?我使用的是vs2008


当前回答

我遵循这些步骤,并使用名为Resharper的开发工具,顺便说一句,它非常棒:

So,

Copy the existing project folder to the destination you want Go to source control and with right click just to the root folder you want and pick "Add items to folder...".Then, a wizard will come up to choose the files to copy (there is no need for some files and the wizard guides you for that reason by default). Change the name of the solution file (*.sln) Change the names of the sub-projects if exist. Use Resharper to change the binding namespaces name (I will automatic do the dirty job with safety).The alternative way is to manually change all namespaces with the new name. The same action with method names. Check solution's properties if you want to change.

就是这样。你准备好了!!

其他回答

我的解决方案有点不同——包所在的计算机死了,所以我被迫在另一台计算机上重新创建它。

我所做的(在VS 2008中)是在我的目录中打开以下文件:

                  - <package name>.djproj
                  - <package name>.dtproj.user
                  - <package name>.dtxs
                  - <package name>.sln
                  - Package.dtsx

当我这样做的时候,一个弹出窗口问我是否sln文件将是一个新的解决方案,当我点击“是”一切工作完美。

按照Shane上面的回答(顺便说一句,这很有效)……

您可能会在参考列表中遇到大量黄色三角形。 大多数这些可以消除Build->清洁解决方案和Build->重建解决方案。

我确实碰巧有一些谷歌API的参考,有点固执…以及NewtonSoft JSon。

试图重新安装相同版本的NuGet包失败。 Visual Studio认为您已经安装了它。

要解决这个问题: 1:写下原始版本。 2:安装下一个更高/更低的版本…然后卸载。 3:安装步骤1中的原始版本。

完全不建议复制项目,因为一些内部形成的配置文件,如.csproj, .vspscc等可能(而且很可能)指向属于以前解决方案的位置和系统或TFS中的其他路径/位置的引用。除非你是阅读这些文件和修复引用的专家,否则不要试图复制项目。

您可以创建一个与您打算复制的相同类型的框架项目,这将创建一个适当的.csproj, .vspscc文件。现在你可以自由地复制类文件,脚本和其他内容从以前的项目,因为他们不会影响。这将确保平稳的构建和版本控制(如果您对此感兴趣的话)。

说了这么多,让我给你一个循序渐进复制项目的方法:

Go to the project you want to copy in solution explorer and right-click. Now select 'Open Folder in File Explorer' (Assuming you have the solution mapped to a local path on your disk). Select the Projects you want to replicate as whole folders(along with all dependencies,bin .vspscc file, .csproj file) Paste them in your desired location (it could be your same solution folder or even another solution folder. If it is within the same solution folder, then you would be required to rename it, also the .csproj and other internal files to the new name). No go back to Visual Studio, Right-Click on Solution > Add > Existing Project... Browse and select the Project file (.csproj file) now from the location you placed it in and select 'open' This file now appears in the solution explorer for you to work.

你现在可能不得不解决一些构建错误,可能是重复/缺失的引用和东西,但否则它是原始的逻辑和结构,因为你期望它是。

如果你想要一个副本,最快的方法就是保存项目。然后在文件系统中复制整个文件。回到Visual Studio并打开副本(通过右键单击solution => add existing project =>打开复制的项目)。从那里,我很可能会建议重新命名项目/解决方案(安全重命名项目的步骤在下面的链接中),这样你就不会有两个相同的名称,但这是复制的最快方法。

最简单的方法是将项目导出为模板,并将其保存到默认模板位置。然后,将模板复制到您想要移动到的位置的相同目录中。在此之后,在新位置上打开visual studio,创建一个新项目,您将得到一个搜索模板的提示。搜索你命名的模板,选择它,你就完成了!