我有一个ItemGroup,并且想要并行处理所有项目(使用自定义任务或.exe)。
/maxCpuCount参数结合使用,因为否则我可能最终会过度并行化。/maxCpuCount仅适用于构建不同的项目,不适用于项目(请参见下面的代码)如何并行处理ItemGroup中的项目?
有没有一种方法可以编写自定义任务以与MSBuild的Parallel支持并行工作?
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Build" >
<!-- Runs only once - I guess MSBuild detects it's the same project -->
<!--<MSBuild Projects="$(MSBuildProjectFullPath);$(MSBuildProjectFullPath)" Targets="Wait3000" BuildInParallel="true" />-->
<!-- Runs in parallel!. Note that b.targets is a copy of the original a.targets -->
<MSBuild Projects="$(MSBuildProjectFullPath);b.targets" Targets="Wait3000" BuildInParallel="true" />
<!-- Runs sequentially -->
<ItemGroup>
<Waits Include="3000;2000"/>
</ItemGroup>
<Wait DurationMs="%(Waits.Identity)" />
</Target>
<Target Name="Wait3000">
<Wait DurationMs="3000" />
</Target>
<UsingTask TaskName="Wait" TaskFactory="CodeTaskFactory" …Run Code Online (Sandbox Code Playgroud) 我们是一个相当大的项目,有一个主干分支.其中大多数使用默认权限,但有些文件夹具有自定义权限 - 例如,只允许"构建者"组签入.
我们希望允许人们从主干创建他们自己的私人分支,在那里他们可以自由地登记并稍后合并(希望经常).但是,创建分支时,特殊权限将与文件夹一起复制,这意味着人们无法自由签入其分支.
我们使用TFS2012和VS2012(有些人使用Update1和一些Update2).).在某些人的机器上,我们得到:
TF400324: Team Foundation services are not available from server vstfps\Protection.
Technical information (for administrator):
Page not found.
Run Code Online (Sandbox Code Playgroud)
这在VS2012和运行"tf.exe get"时的任何源控制访问中都会发生.但是,其他TFS服务工作正常,例如工作项查询.
我已经卸载并重新安装了VS(这次没有Update2),问题仍然存在.
我发现了一个类似的问题报告,虽然它有些不同,但两种方式都没有解决.
使用Netmon进行调试时,我注意到受影响的计算机使用不同的URI:
Good: /tfs/Protection/VersionControl/v4.0/repository.asmx
Bad: /tfs/Protection/VersionControl/v5.0/repository.asmx
Run Code Online (Sandbox Code Playgroud)
是什么决定了机器使用的URI?我怎么能改变呢?
我有一个生成几个NuGet包的解决方案,我在构建期间打包.我希望我的夜间版本被标记为预发布,所以我相应地对我的软件包进行版本化:1.2.3-PreRelease0001.但是,一旦每晚构建通过测试,我想发布相同的版本,使用相同的包,但使用非PreRelease版本:1.2.3.
我的问题:如何使用不同的版本重新打包NuGet包?我想我可以破解一些解压缩/编辑/ nuget pack脚本,但是有更好的方法吗?
备择方案:
<Content>直接从源代码访问文件GeneratedDoNotTouch文件夹中......我正在调试WinDbg中的进程,并退出该进程:
0:009> g
(bunch of regs...)
ntdll!NtTerminateProcess+0xc:
770ad43c c20800 ret 8
0:009> g
^ No runnable debuggees error in 'g'
Run Code Online (Sandbox Code Playgroud)
此时,如何获取进程的退出代码?
我有一个控制台应用程序,它使用TFS API创建工作项.我希望应用程序启动Visual Studio,打开创建的工作项.我试过了:
Process.Start("vstfs:///WorkItemTracking/WorkItem/123?url=http://mytfs:8080/tfs/mycollection")
Run Code Online (Sandbox Code Playgroud)
这将打开Visual Studio(我有2013更新3),并打开一个工作项,说"打开工作项123 ...",但VS从未实际完成此打开.如果我关闭此窗口,我会收到错误消息The given key was not present in the dictionary.
我尝试从命令行/ devenv,两个都得到了相同的结果:
C:\> start vstfs:///WorkItemTracking/WorkItem/123?url=http://mytfs:8080/tfs/mycollection
C:\> "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" /Tfslink vstfs:///WorkItemTracking/WorkItem/123?url=http://mytfs:8080/tfs/mycollection
Run Code Online (Sandbox Code Playgroud)
我尝试打开另一个TFS项目 - 构建 - 并且工作正常:
C:\> start vstfs:///Build/Build/111?url=http://mytfs:8080/tfs/mycollection
Run Code Online (Sandbox Code Playgroud)
我可以在Web UI中打开它们 - 但我的用户对Visual Studio更熟悉.
那么,如何在VS中启动工作项?
我想运行几个任务,其中一些任务将异步完成,然后等待所有任务完成。由于任务可能会引发异常,因此我想捕获并记录它们。该示例代码:
static async Task doit(int x)
{
try
{
Console.WriteLine("{0} {1} start", x, Thread.CurrentThread.ManagedThreadId);
await Task.Run(() =>
{
Thread.Sleep(TimeSpan.FromSeconds(2 + x)); // simulate long-running stuff worth awaiting...
if (x == 3)
{
throw new Exception("Exception inside task " + x.ToString()); // Simulate the async task throwing exception
}
});
if (x == 2)
{
throw new Exception("Exception after task " + x.ToString()); // Simulate post-async task throwing exception
}
Console.WriteLine("{0} {1} end", x, Thread.CurrentThread.ManagedThreadId);
}
catch (Exception ex)
{
Console.WriteLine("{0} …Run Code Online (Sandbox Code Playgroud) 我试图确定为什么我的应用程序消耗 4GB 的私有字节。所以我做了一个完整的内存转储,把它加载到windbg中。但是分析 using!heap -stat -h会产生奇怪的结果,这些结果不会相加:
0:000> !heap -s
(...)
Heap Flags Reserv Commit Virt Free List UCR Virt Lock Fast
(k) (k) (k) (k) length blocks cont. heap
-------------------------------------------------------------------------------------
000002d0a0000000 00000002 2800804 2780508 2800700 2984 1980 177 0 6 LFH
000002d09fe10000 00008000 64 4 64 2 1 1 0 0
000002d09ff70000 00001002 1342924 1334876 1342820 13042 3342 87 0 0 LFH
Run Code Online (Sandbox Code Playgroud)
好的,我得到了一个 2.8GB 的堆和一个 1.34GB 的堆。让我们看看第一个的分配:
0:000> !heap -stat -h 000002d0a0000000
heap @ 000002d0a0000000
group-by: TOTSIZE max-display: …Run Code Online (Sandbox Code Playgroud) 在我的 C++/WinAPI 代码中,我想运行一些命令并捕获它们的输出。为了测试非 ASCII 输出,我将网络连接重命名为Eth\xc3\xa9rn\xc3\xa9t \xd7\x90\xd7\x91\xd7\x92 \xd0\x91\xd0\xb1\xd0\x93\xd0\xb3\xd0\x94\xd0\xb4并运行ipconfig. 在命令提示符下运行时,输出正确(使用 Courier New 等支持字体时可见):
C:\\>ipconfig\nWindows IP Configuration\n\nEthernet adapter Eth\xc3\xa9rn\xc3\xa9t \xd7\x90\xd7\x91\xd7\x92 \xd0\x91\xd0\xb1\xd0\x93\xd0\xb3\xd0\x94\xd0\xb4:\n(...)\nRun Code Online (Sandbox Code Playgroud)\n\n我尝试按照此答案中的示例将输出重定向到管道。但返回的字节数组ReadFile()不是 unicode - 它是用 CP_OEMCP 编码的(在我的例子中是 CP437),因此希伯来语和俄语字符显示为“?”。由于字符已经丢失,任何进一步的处理都无法恢复它们。
显然这是可能的,因为控制台窗口中的 cmd 可以做到这一点。我该怎么做?
\n我正在尝试从我的公司本地托管的 TFS/devops 克隆 git 存储库。但是,我失败了:
batch response: Post (...) HTTP_1_1_REQUIRED
我看到建议通过运行git lfs install --skip-smudge
或设置来跳过污迹GIT_LFS_SKIP_SMUDGE=1,但随后 lfs 提供的二进制文件不会被提取,并且我会收到编译错误。
windbg ×2
asynchronous ×1
azure-devops ×1
branch ×1
c# ×1
c++ ×1
exception ×1
git-lfs ×1
heap ×1
msbuild ×1
nuget ×1
permissions ×1
stdout ×1
tfs ×1
tfs2010 ×1
tfs2012 ×1
unicode ×1
versioning ×1
winapi ×1