我想复制一份我的项目。我宁愿不从头开始添加文件和引用等。请注意,我指的不是用于部署的复制。只是简单的复制。
VS中有这样的工具吗?我使用的是vs2008
我想复制一份我的项目。我宁愿不从头开始添加文件和引用等。请注意,我指的不是用于部署的复制。只是简单的复制。
VS中有这样的工具吗?我使用的是vs2008
当前回答
按照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.
你现在可能不得不解决一些构建错误,可能是重复/缺失的引用和东西,但否则它是原始的逻辑和结构,因为你期望它是。
我有一个项目,源文件在项目文件夹下面的文件夹中。当我复制没有源文件夹的项目文件夹并打开复制的项目时,源文件并没有丢失,而是在旧位置找到。我关闭项目,复制源文件夹,并重新打开项目。现在,项目神奇地引用了复制的源文件(新路径显示在“另存为”上,文件中的更改已保存在复制的版本中)。
这里有一个警告:如果旧项目文件夹和新项目文件夹都在一个使用过的库文件夹下面,上述魔术也会丢弃对库的绝对引用,并期望它位于相同的相对路径下。
我尝试用VS Express 2012。
只需要创建一个模板;
从您的项目选择:项目-导出模板
向导将允许您定义
模板名称 模板描述 图标 预览图像
然后它将你的项目压缩到“我的导出模板”目录。 您还可以选择在创建新项目时使模板可用。
当你使用你的模板创建一个新的项目,命名空间将是正确的` your_new_project_name'贯穿每个文件,所有引用正确,一切完美:)
你可以将。zip文件发送给任何人,他们必须复制(而不是解压缩)。zip文件到Templates\ProjectTemplates目录中供他们使用。
我做了一个ASP。NET MVC模板与文件夹,布局页面,视图模型等安排只是我喜欢他们。
注意: 如果你在你的项目中有一个空文件夹,它不会被添加到模板中,所以我只是添加了一个空类,适用于每个文件夹,和一个示例图片的图像文件夹。
最简单的方法是将项目导出为模板,并将其保存到默认模板位置。然后,将模板复制到您想要移动到的位置的相同目录中。在此之后,在新位置上打开visual studio,创建一个新项目,您将得到一个搜索模板的提示。搜索你命名的模板,选择它,你就完成了!
我遵循这些步骤,并使用名为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.
就是这样。你准备好了!!