简体   繁体   English

TFS-放置文件夹中的版本控制文件

[英]TFS - Versioning file in a drop folder

We currently use TFS 2010 for controlling some of our .NET projects. 当前,我们使用TFS 2010来控制某些.NET项目。

I'd like to know whether it's possible to provide some kind of versioning within TFS for a specific folder on a network share for example. 我想知道是否可以在TFS中为例如网络共享上的特定文件夹提供某种版本控制。

The idea being is to control release packages (zips) for every release we do. 想法是控制我们执行的每个发行版的发行包(zip)。 As this bit is done by some other person (not technical and he doesn't use Visual Studio or any tech tool), it'd be great to streamline the process of versioning the zip files for every release. 由于此操作是由其他人(不是技术人员,并且他不使用Visual Studio或任何技术工具)完成的,因此简化每个发行版本的zip文件的版本控制流程将非常有用。

Technically speaking: We've setup this folder \\servername\\releasezips and every time I drop a file named release.zip, it would automatically commit (push) this file to the TFS server (no comments needed) and furthermore, once the file contents change (meaning that someone dropped another version of the file in there), the system would again push the file to TFS, but with a following version. 从技术上来讲:我们已经设置了该文件夹\\ servername \\ releasezips,每次我放下一个名为release.zip的文件时,它将自动将该文件提交(推入)TFS服务器(无需注释),此外,一旦文件内容更改(意味着有人在其中放置了该文件的另一个版本),系统将再次将该文件推送到TFS,但具有以下版本。

Is this possible somehow? 这有可能吗? I've seen somewhere that I could programatically have some extra control over TFS, using REST API. 我看到某个地方可以使用REST API对TFS进行编程控制。

Thanks in advance! 提前致谢!

Thanks for your tips, Daniel and PatrickLu-MSFT. 感谢您的提示,Daniel和PatrickLu-MSFT。

As I said, I did want something straighforward, some kind of control similar to what box.com provides, where you associate a local folder on your machine with the cloud. 就像我说的那样,我确实想要一些简单的方法,类似于box.com提供的控件,您可以在其中将计算机上的本地文件夹与云相关联。 So, once you drop files in the local folder, the small box client synchronizes it along with the cloud. 因此,一旦将文件拖放到本地文件夹中,小盒子客户端就会将其与云同步。 If access the box.com, I can see the different versions of that specific file. 如果访问box.com,则可以看到该特定文件的不同版本。

So what I did was, I've created a small .NET app to monitor the folder and any new files dropped in there would get checked in to our TFS server, by using the tf command line (of course ignoring work items or comments). 所以我要做的是,我创建了一个小型的.NET应用程序来监视文件夹,并且使用tf命令行(当然会忽略工作项或注释),将所有放置在其中的新文件都签入到我们的TFS服务器中。 。

So, progamatically within the .NET app, it builds up the tf required commands for processing and versioning the recently dropped files and therefore, executes them. 因此,它在.NET应用程序中以编程方式构建tf必需的命令,用于处理和丢弃最近删除的文件并对其进行版本控制,然后执行它们。

By the way, I could have used the Team Foundation API in order to do the same job, but it would demand way more effort. 顺便说一句,我本可以使用Team Foundation API来完成相同的工作,但是这需要更多的精力。

Cheers 干杯

According to your description, you want to commit/check in files during the build/release pipeline. 根据您的描述,您想在构建/发布管道中提交/签入文件。

It's not a recommend way to check-in generated build files and modify source code during a build pipeline. 这不是在生成管道期间检入生成的生成文件和修改源代码的推荐方法。 If you really want to do this, you could edit the build workspace files and use tf commands in custom activity and call the powershell eq: 如果确实要执行此操作,则可以编辑构建工作区文件并在自定义活动中使用tf命令并调用powershell eq:

cd $env:BUILD_SOURCESDIRECTORY

$TFFile = Get-Item "C:\Program Files (x86)\Microsoft Visual Studio 1x.0\Common7\IDE\TF.exe"

$tfOutput = [string]( & $TFFile.FullName checkin /noprompt /override:"***NO_CI*** New version is $newVersion." /comment:"***NO_CI*** New version is $newVersion." 2>&1)

Another way is installing TFS Power Tool and use the Windows PowerShell Cmdlets to check in the files. 另一种方法是安装TFS Power Tool并使用Windows PowerShell Cmdlet检入文件。 Refer to this link for more details: PowerShell and TFS: The Basics and Beyond 有关更多详细信息,请参考此链接: PowerShell和TFS:基础知识及其他

For version the dropped files, you could take a look this similar question: TFS Build Copy to Versioned Folder Basically, you have to customize build definition with custom activity and based on build.buildnumber variable to generate/create .zip file. 对于所删除文件的版本,您可以看一下类似的问题: TFS Build复制到Versioned文件夹基本上,您必须使用自定义活动自定义构建定义,并基于build.buildnumber变量来生成/创建.zip文件。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM