我需要能够通过Powershell更改Team Foundation Server 2010中文件的“ANSI NULL”属性:
cls
if ( (Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PSSnapin Microsoft.TeamFoundation.PowerShell
}
[Microsoft.TeamFoundation.Client.TfsTeamProjectCollection] $tfs = get-tfsserver "http://tfsserver.com"
$items = Get-TfsItemProperty -Server $tfs -Item "$/databaseproject/Database/trunk/Database/Stored Procedures" -Recurse | where{$_.ItemType -eq "File"}
foreach($item in $items)
{
#i'm stuck on how to get/change the file item properties
}
基本上,我想将TFS中.sql文件的ANSI NULLS属性从ON更改为OFF。我有大约60个要改变。
TIA!
答案 0 :(得分:1)
我不相信Get-TfsItemProperty输出的对象上有ANSI NULL属性,即使它确实具有这样的属性,您也无法更改它。 Get-TfsItemProperty根据从服务器检索的信息创建本地数据对象。它是不可变的,即它的所有属性只有getter(不是setter)。
此属性更有可能是在某个文件中捕获的设置(.dbschema ??)。在这种情况下,我通常建议您检查该文件,修改设置并重新检入。但是,我跑过this Q&A that might help。具体看答案8& 9.答案8表示可能存在甚至更改设置无效的错误。答案9有一些建议的解决方法。