我有一些答案!随意贡献自己的发现.
据我所知,有三种主要方法可以从TFS中检索一个简单的团队项目列表:
我在进行的简单测试中比较了计算返回项目总数时的三种方法.
方法1:目录服务(仅限TFS 2010)
public IEnumerable<string> GetTeamProjectNamesUsingCatalog()
{
ReadOnlyCollection<CatalogNode> projectNodes = new TfsTeamProjectCollection(collectionUri).CatalogNode.QueryChildren(
new[] { CatalogResourceTypes.TeamProject },
false, CatalogQueryOptions.None);
foreach (var tp in projectNodes)
yield return tp.Resource.DisplayName;
}
Run Code Online (Sandbox Code Playgroud)
方法2:VersionControlServer
public IEnumerable<string> GetTeamProjectNamesUsingVCS()
{
TfsTeamProjectCollection tp = new TfsTeamProjectCollection(collectionUri);
foreach (var p in tp.GetService<VersionControlServer>().GetAllTeamProjects(false))
yield return p.Name;
}
Run Code Online (Sandbox Code Playgroud)
方法3:ICommonStructureService
public IEnumerable<string> GetTeamProjectNamesUsingStructureService()
{
var structService = new TfsTeamProjectCollection(collectionUri).GetService<ICommonStructureService>();
foreach (var p in structService.ListAllProjects())
yield return p.Name;
}
Run Code Online (Sandbox Code Playgroud)
我跑的单元测试非常简单.我使用.Count()方法来确保我们迭代所有团队项目(.Any()更快,因为它将在返回第一个名称后停止).
结果
对于TFS 2010,连续5次运行3次测试:


对于TFS 2008,连续5次运行2次测试(无目录服务):


偏见 …
我正在使用新的MSBuild内联任务来利用Microsoft.Web.Publishing.Tasks.dll程序集中的TransformXml(XDT转换).
这是我的任务(剪切)看起来像:
<Task>
<Reference Include="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>
<Reference Include="System.Xml" />
<Using Namespace="System"/>
<Using Namespace="System.Linq"/>
<Using Namespace="System.IO" />
<Using Namespace="System.Xml"/>
<Using Namespace="Microsoft.Web.Publishing.Tasks"/>
<Code Type="Fragment" Language="cs">...</Code>
</Task>
Run Code Online (Sandbox Code Playgroud)
这个编译很好并且加载了DLL,但是,在执行时它失败了,因为它试图在appbase路径中找到组件:C:\Windows\Microsoft.NET\Framework\v4.0.30319.我原以为它会看到我给它的路径.
Fusion日志显示:
=== Pre-bind state information ===\r
LOG: User = xxx\Kamran\r
LOG: DisplayName = Microsoft.Web.Publishing.Tasks, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)\r
LOG: Appbase = file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/\r
LOG: Initial PrivatePath = NULL\r
Calling assembly : (Unknown).\r
===\r
LOG: This bind starts in default load context.\r
LOG: Using application configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe.Config\r
error MSB4018: LOG: Using host configuration …Run Code Online (Sandbox Code Playgroud) TextMate是否可以语法突出显示当前插入符号位置的开始和结束标记?我一直在谈论,而不是按一个关键的组合.
此外,如果可能,我该怎么办?除了在主题中使用选择器之外,似乎没有任何我知道的方式,但我不知道选择器是否可以是上下文相关的.
我不想做的事:
我想做什么:
我会没事的:
它只是不起作用,我觉得这是不可能的100%跨浏览器方式使用普通的旧jQuery方法.
例证:
<!DOCTYPE html>
<html>
<head>
<title>IE Sucks</title>
<script src="Scripts/jquery-1.5.min.js" type="text/javascript"></script>
<script type="text/javascript">
var xml =
'<Browsers>' +
'<CoolBrowsers>' +
'<Browser name="Opera"></Browser>' +
'<Browser name="Chrome"></Browser>' +
'<Browser name="Firefox"></Browser>' +
'</CoolBrowsers>' +
'<BadBrowsers>' +
'<Browser name="IE6"></Browser>' +
'</BadBrowsers>' +
'</Browsers>';
$(function () {
$("#xml").text(xml);
var uncoolBrowser = $("<Browser />").attr("name", "IE7");
// In 1.5, using this...
var $xml = $($.parseXML(xml));
// Nope. Works everywhere else, though!
// var $xml = $(xml); …Run Code Online (Sandbox Code Playgroud) 每当我尝试构建时,我都会收到此错误.我刚刚安装了Visual Studio 2012和.Net 4.5,但这个项目仍然在2010年.
以下是我遇到问题的代码行:
private static MethodInfo _encode;
public static string Encode(CookieProtection cookieProtection, byte[] buf, int count)
{
return (string)_encode.Invoke(null, new object[] { cookieProtection, buf, count });
}
Run Code Online (Sandbox Code Playgroud)
我收到一条ArgumentException was unhandled by user code错误消息,说"Object of type 'System.Int32' cannot be converted to type 'System.Web.Security.Cryptography.Purpose'" 我的开发环境没有任何变化,我的同事没有遇到同样的问题,但他们也没有VS2012.
我发现一篇关于Sitecore 的文章有这个错误,但这是我见过的唯一一个弹出的地方.
他们在那里说,"这是因为在.NET 4.5中,System.Web中有一些新的命名空间"
他们的解决方案是:
这似乎是一个荒谬的解决方案,4.5和4不能在同一台机器上.
在我尝试卸载并重新安装一堆东西之前,是否有人知道可能导致此问题以及任何更好的解决方案?
评论也说尝试:</setting name="login.rememberlastloggedinusername" value="false" >但我也不想这样做.
我创建了一个像这样的DbContext:
public class myDB : DbContext
{
public DbSet<Party> Parties { get; set; }
public DbSet<Booking> Bookings { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
这生成了我的DataBase和上面的两个表......很棒
然后我决定在混合中添加另一个DbSet,我收到一个错误:
自创建数据库以来,支持"Party"上下文的模型已更改
我知道使用modelbuilder.IncludeMetadataInDatabase = false;和修复此问题Database.SetInitializer<ClubmansGuideDB>(null);
1)将新类添加到上下文并在DataBase中生成它们的正确方法是什么?
2)我自己试图解决这个问题,我删除了表并试图重新运行应用程序但没有成功我然后删除了完整的数据库并重新运行它并没有重新生成数据库.我怎样才能从头开始 - 某处有缓存吗?
我发誓这没有意义.
鉴于我有HttpRouteCollection来自Web API的这个,我基于一些自定义路由类型进行过滤,特别是IAttributeRoute.我用,httpRoutes.OfType<IAttributeRoute>()但循环表现得像没有元素.
要清楚,当这个循环被击中时,整个集合都是HttpAttributeRoute直接实现的类型IAttributeRoute.此外,我在常规操作上有相同的循环操作RouteCollection.
这不起作用:
foreach (IAttributeRoute route in GlobalConfiguration.Configuration.Routes.OfType<IAttributeRoute>()) {
if (!string.IsNullOrWhiteSpace(route.RouteName) && !json.ContainsKey(route.RouteName)) {
json.Add(route.RouteName, "/" + route.Url);
}
}
Run Code Online (Sandbox Code Playgroud)
然而,这很好:
foreach (var route in GlobalConfiguration.Configuration.Routes)
{
if (route is IAttributeRoute) // uhhhh?
{
var r = route as IAttributeRoute;
if (!string.IsNullOrWhiteSpace(r.RouteName) && !json.ContainsKey(r.RouteName))
{
json.Add(r.RouteName, "/" + r.Url);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我发誓我不是在撒谎,它只适用于后一种代码.就像我说的那样,在正常的路线收集上这样做很好.正常的路由集合有其他类型的,不只是IAttributeRoute,但HttpRouteCollection 只具有IAttributeRoute在其当前状态(在未来也可能有不同类型的路由).这可能是一个因素吗?
我错过了什么或者没有OfType做我在内部做的事情吗?
我喜欢在我正在编写的实用程序(C#console app)中使用Pandoc,我在GitHub,libpandoc和扩展程序中找到了这个绑定项目,它是.NET绑定项目libpandoc-dotnet.
我希望作者已经包含了构建的DLL,但我想他想让它对未来的Pandoc版本开放.
我没有任何Haskell经验,我最终只想要.NET绑定.我正在尝试安装依赖项,cabal但我不理解错误消息,粗略的搜索让我相信安装base是禁止的,所以我不知道该怎么做.
C:\Development\Contrib\libpandoc>cabal install base-4.1.0.0
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: base (user goal)
rejecting: base-3.0.3.2, 3.0.3.1, 4.6.0.1, 4.6.0.0, 4.5.1.0/installed-7c8...,
4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1,
4.2.0.0 (global constraint requires ==4.1.0.0)
rejecting: base-4.1.0.0 (only already installed instances can be used)
rejecting: base-4.0.0.0 (global constraint requires ==4.1.0.0)
如果一个善良的灵魂甚至可以建造该死的东西(叉它?把它上传到某个地方?)我永远爱你.或者,告诉我如何正确地构建它,我可以从那里处理它.虽然现在我考虑过它,但不确定我是否安装了C编译器.
更新:
好.所以这一切都归结为libpandoc已经使用了3年,其依赖关系已经过时了.我没有运气试图让所有旧的Haskell工具安装和工作,我可能不知道我在做什么.我已经安装了一些依赖项,但是一些依赖项没有版本化,所以我必须专门跟踪每个版本,我最终放弃了.
然后我刚刚更新了libpandoc本身的依赖版本,现在我已经构建并链接了所有依赖项.
唯一剩下的问题是需要更新libpandoc以对抗最新的Pandoc版本(1.10).
我终于能够创建一个"简单"的透明按钮控件,基于a ContentControl.但是,有人可以解释为什么我不能点击/点击控件的任何空白区域,直到我将子元素的背景设置为透明?在以下情况下我也遇到了这个问题:
这是我的"按钮"类:
public class TransparentButton : ContentControl {
public TransparentButton() {
HorizontalContentAlignment = HorizontalAlignment.Stretch;
}
public override void OnApplyTemplate() {
var child = Content as Grid;
if (child != null) {
child.Background = new SolidColorBrush(Colors.Transparent);
}
base.OnApplyTemplate();
}
}
Run Code Online (Sandbox Code Playgroud)
它在使用时假定我的情况非常具体(假设一个Grid子元素),但它有效.我使用它的原因是对于启用了TiltEffect的列表(非ListBox).
问题的背景:
<ItemsControl x:Name="Items" toolkit:TiltEffect.IsTiltEnabled="True">
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:TransparentButton
cal:Message.Attach="[Event Tap] = [Action Go($dataContext)]">
<Grid>
<StackPanel HorizontalAlignment="Left">
<TextBlock Text="{Binding Test}" />
</StackPanel>
<StackPanel HorizontalAlignment="Right">
<TextBlock Text="{Binding Test2}" />
</StackPanel>
</Grid>
</controls:TransparentButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl> …Run Code Online (Sandbox Code Playgroud)