简体   繁体   English

如何使用Visual Studio 2012 Professional管理我的项目版本

[英]How can I manage my projects versions using Visual Studio 2012 Professional

I am working on developing an asp.net mvc web application , using visual studio 2012 professional. 我正在使用visual studio 2012专业人员开发asp.net mvc web应用程序。 now when I want to update my project, for example by adding new features, I do the following steps:- 现在,当我想更新我的项目时,例如通过添加新功能,我执行以下步骤: -

  • I copy the project folder. 我复制项目文件夹。
  • past it inside a "versioning" folder. 过去它在“版本控制”文件夹中。
  • work on the original project , were I add the new features and code. 在原始项目上工作,我是否添加了新功能和代码。
  • now if I want to revert my project back before the new features, I can open the folder inside the "Versioning" folder. 现在,如果我想在新功能之前恢复我的项目,我可以打开“Versioning”文件夹中的文件夹。 and so on... 等等...

now my current approach is some how sufficient.. but I am trying to find a more automated approach where I can for example revert certain file let say a certain .cs file to its previous version , or revert back my whole project to certain point. 现在我当前的方法是一些多么充足..但我试图找到一个更自动化的方法,我可以例如恢复某些文件让一个.cs文件到其先前的版本,或将我的整个项目恢复到某一点。

so can anyone advice how Visual studio 2012 can help me in managing my versioning ? 那么有人可以建议Visual Studio 2012如何帮助我管理我的版本控制? Thanks in advance for any help. 在此先感谢您的帮助。

Regards 问候

You'll want to use a version control system like Team Foundation Server (TFS), Git, Mercurial, Subversion, etc. I personally recommend Git. 您将需要使用Team Foundation Server(TFS),Git,Mercurial,Subversion等版本控制系统。我个人推荐Git。 Many of them have a means of integration with Visual Studio 2012 (for example, see How to Connect Visual Studio 2012 with git (github)? ). 其中许多都有与Visual Studio 2012集成的方法(例如,请参阅如何使用git(github)连接Visual Studio 2012? )。 Version control software supports features such as tracking file changes, creating code branches, merging code from different commits/users back together, etc. 版本控制软件支持诸如跟踪文件更改,创建代码分支,将来自不同提交/用户的代码合并在一起等功能。

Here's what a very simple workflow might look like with version control (see https://guides.github.com/introduction/flow/ for an example of the GitHub flow): 以下是使用版本控制时非常简单的工作流程(请参阅https://guides.github.com/introduction/flow/以获取GitHub流程的示例):

  1. You're ready to add a new feature/start a new version. 您已准备好添加新功能/启动新版本。 For simplicity we'll assume you're working on a single branch (eg Git "master" branch). 为简单起见,我们假设您正在处理单个分支(例如Git“master”分支)。
  2. As you program, you make incremental changes to you source code and commit those changes regularly. 在编程时,您需要对源代码进行增量更改并定期提交这些更改。 Each commit gives you a snapshot of the work you've done and you can go back to any commit at any point and compare the changes between commits. 每次提交都会为您提供已完成工作的快照,您可以随时返回任何提交并比较提交之间的更改。 The VCS you choose will influence how you synchronize those changes with a central/remote repository. 您选择的VCS将影响您将这些更改与中央/远程存储库同步的方式。 You can even check revision history and look at previous versions of specific files and your code is typically backed up on another server for you without much additional work. 您甚至可以检查修订历史记录并查看特定文件的先前版本,并且您的代码通常会在您的其他服务器上备份而无需额外的工作。
  3. When you're ready to release, you could tag a specific revision (or merge features branches into master, or ... etc.). 当您准备发布时,您可以标记特定修订(或将功能合并到主服务器,或者......等)。 Whatever the case, you can keep track of all the cumulative changes you've made for each release and be able to revert back to any point. 无论如何,您都可以跟踪您为每个版本所做的所有累积更改,并能够恢复到任何一点。

There are a few other steps you may consider for versioning such as updating the assembly information. 您可以考虑进行版本控制等一些其他步骤,例如更新装配信息。 In the AssemblyInfo.cs file there is assembly metadata specifying the assembly version, file version (or informational version, which I prefer). 在AssemblyInfo.cs文件中,有程序集元数据指定程序集版本,文件版本(或信息版本,我更喜欢)。 See What is AssemblyInfo.cs used for? 请参阅AssemblyInfo.cs用于什么? . You can configure Visual Studio to auto-increment the version numbers. 您可以将Visual Studio配置为自动增加版本号。

Team Foundation Server should be available by default with VS 2012, although I'm vague on the details of setting up a TFS server to host your repositories. 默认情况下,VS 2012应该可以使用Team Foundation Server,尽管我对设置TFS服务器以托管您的存储库的细节很模糊。 Visual Studio added direct support for Git (open source, very popular) starting in VS 2013, however there is an extension available for 2012 ( https://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c ). 从VS 2013开始,Visual Studio增加了对Git(开源,非常受欢迎)的直接支持,但是有一个可用于2012的扩展( https://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c ) 。 The extension allows you to perform some of the most used Git functions such as committing, branching, and pushing. 扩展允许您执行一些最常用的Git函数,如提交,分支和推送。

Here are some links to get you started: 以下是一些可以帮助您入门的链接:

Why should I use version control? 我为什么要使用版本控制?

Using Git with Visual Studio 在Visual Studio中使用Git

https://git-scm.com/download/win https://git-scm.com/download/win

https://tortoisegit.org/ https://tortoisegit.org/

https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx

I use VSTS and it is fantastic. 我使用VSTS,真是太棒了。 You can use GIT or TFS version control. 您可以使用GIT或TFS版本控制。 Both are hosted by Microsoft. 两者都由微软托管。 I prefer Microsoft due to the idea of long term support and reliability. 由于长期支持和可靠性的想法,我更喜欢微软。 You can see they are supporting VS 2008 to current. 你可以看到他们支持VS 2008到现在。

https://www.visualstudio.com/team-services/pricing/ https://www.visualstudio.com/team-services/pricing/

It is also free for up to 5 users. 它最多可供5位用户免费使用。

From the link posted below. 从下面发布的链接。 It has full support for many versions of Visual Studio 它完全支持许多版本的Visual Studio

Q: Which versions of Visual Studio can I use with Visual Studio Team Services? 问:Visual Studio Team Services可以使用哪些版本的Visual Studio?

A: You can use: 答:您可以使用:

  • Visual Studio "15" Visual Studio“15”
  • Visual Studio 2015 Visual Studio 2015
  • Visual Studio 2013 Visual Studio 2013
  • Visual Studio 2012 Visual Studio 2012
  • Visual Studio 2010, requires Service Pack 1 and KB2662296 Visual Studio 2010,需要Service Pack 1和KB2662296
  • Visual Studio 2008 SP1, requires GDR update To connect to Team Services with Visual Studio 2008 SP1,需要GDR更新才能连接到Team Services
  • Visual Studio 2008 through 2012 Visual Studio 2008到2012

Start Visual Studio. 启动Visual Studio。 From the Team menu or Team Explorer, go to Connect to Team Foundation Server > Select Team Projects > Servers. 从“团队”菜单或“团队资源管理器”,转到“连接到Team Foundation Server”>“选择团队项目”>“服务器”。 Add your Team Services account ({youraccount}.visualstudio.com). 添加您的团队服务帐户({youraccount} .visualstudio.com)。 Select your team project, and finish connecting. 选择您的团队项目,然后完成连接。 If you get connection errors, try choosing HTTPS as your protocol. 如果出现连接错误,请尝试选择HTTPS作为协议。

https://www.visualstudio.com/en-us/docs/setup-admin/team-services/connect-to-visual-studio-team-services https://www.visualstudio.com/en-us/docs/setup-admin/team-services/connect-to-visual-studio-team-services

GIT Vs TFS Version Control - https://www.visualstudio.com/en-us/docs/tfvc/comparison-git-tfvc GIT与TFS版本控制 - https://www.visualstudio.com/en-us/docs/tfvc/comparison-git-tfvc

One thing to look into is how you visualize editing and checking in code. 需要注意的一件事是如何可视化编辑和检查代码。 I personally find that TFS version control follows a very simple and linear model. 我个人发现TFS版本控制遵循一个非常简单和线性的模型。 I prefer it to git. 我更喜欢git。 But its really Apples vs Oranges and usually people like what they are used to. 但它真的是苹果与橘子,通常人们喜欢他们习惯的东西。 I will say that Git currently is in active development and is not as feature rich as TFS-VC. 我会说Git目前正在积极开发中,并不像TFS-VC那样功能丰富。 Not to mention VSTS hooks into their entire ecosystem of plugins, build systems, test infrastructure and all of their cloud platform "Azure" 更不用说VSTS挂钩了他们整个插件生成系统,构建系统,测试基础架构以及他们所有的云平台“Azure”

If you dont need to be sharing your version controlled stuff, I like TurtleSVN. 如果你不需要分享你的版本控制的东西,我喜欢TurtleSVN。 Its simple and I like the UI it has for displaying modifications between versions. 它很简单,我喜欢用它来显示版本之间的修改。 It adds a choice on the right-click menu of any file or folder in windows explorer for "TurtleSVN" and then all of the operations can be handled from there. 它在Windows资源管理器中为“TurtleSVN”添加了任何文件或文件夹的右键菜单选项,然后可以从那里处理所有操作。

My Suggestion is still using TFS - I my project which is a product ( ASP.MVC application ) - we are using following structure in TFS.. 我的建议仍在使用TFS - 我的项目是一个产品(ASP.MVC应用程序) - 我们在TFS中使用以下结构。

we have a main branch - DEV branch a QA branch and a SP branch. 我们有一个主分支 - DEV分支一个QA分支和一个SP分支。 See screen shot attached) 见附有屏幕截图) 在此输入图像描述 Main Branch - Where all the code is merged using scripts - before we start with new version of development and then a new DEV branch with version is created from this main branch.. - so we have track of every version and new features added to each version... and For new client the code from Main branch is given. 主分支 - 所有代码都使用脚本合并 - 在我们开始新版本的开发之前,然后从这个主分支创建一个带有版本的新DEV分支... - 所以我们跟踪每个版本和添加到每个版本的新功能version ...对于新客户端,给出了Main分支的代码。

Dev - Based on features added we create different folder for each new set of features / enhancements and put the version. 开发 - 基于添加的功能,我们为每组新功能/增强功能创建不同的文件夹并放置版本。

SP - After development is completed - the DEV branch is freeze and we create a new branch id SP and deploy the code for QA team - any defect founs are fixed in SP and deployed to QA - once testing is done the code is SP is freeze with QA approved and deployed to main and provided to Clients.. SP - 开发完成后 - DEV分支冻结,我们创建一个新的分支ID SP并为QA团队部署代码 - 任何缺陷都在SP中修复并部署到QA - 一旦测试完成,代码就是SP冻结QA批准并部署到主要部门并提供给客户..

Finally using script - every thing from SP is merged in to Main.. and for new development - a new Branch in DEV is created from the Main.. This way we have track of enhancements / feature for each DEV phase and related SP is available and our product is getting developed in Main. 最后使用脚本 - 来自SP的所有东西都合并到Main ..并且对于新开发 - 从Main创建DEV中的新分支。这样我们就可以跟踪每个DEV阶段的增强/功能,并且相关的SP可用我们的产品在Main开发。

Hope this Helps.. 希望这可以帮助..

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我无法在 Visual Studio 中合并项目 sdk 版本? - Why I can't consolidate projects sdk versions in Visual Studio? 我该如何管理.Net和Visual Studio版本? - How should I manage .Net and Visual Studio versions? 如何在没有Visual Studio的情况下管理大型项目? - How to manage large projects without Visual Studio? 无法在Visual Studio 2012 Professional中导入数据库 - Not able to import database in Visual Studio 2012 Professional 如何使用NuGet软件包管理器控制台在Visual Studio 2012 Pro上安装OpenPop.NET? - How can i install OpenPop.NET on my visual studio 2012 pro using the NuGet package manager console? 如何在我的Visual Studio 2012项目中引用XML文件作为项目代码中的数据源? - How can I reference an XML file in my Visual Studio 2012 project as a data source in my project code? 如何在Visual Studio 2012中在自己的数据库中创建成员资格表 - How Can I Create Membership Tables In My Own Database in Visual Studio 2012 Visual Studio 2012没有显示我曾参与过的最近项目 - Visual Studio 2012 not showing recent projects which I have worked on Visual Studio 2022 Professional:如何获得 C# 的 Web GUI 应用程序? - Visual Studio 2022 Professional: How can I get Web GUI apllication for C#? 如何在Visual Studio 2012中切换(或突出显示)同一解决方案的项目? - How do i switch between (or highlight) projects of the same solution in Visual Studio 2012?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM