build - 在 Visual Studio Team Services 构建期间以管理员身份运行

我正在处理一个我们延迟签署程序集的项目。我需要在构建过程中使用强名称工具几次,关闭强名称验证,然后在打包程序集之前对其进行完全签名。我尝试使用 powershell 步骤关闭验证,但它返回此错误:

脚本:

$testprojs = gci Project.*.dll -r
$testprojs | % {
            sn -Vr $_
            write-output $("Turned off sn verification for " + $_.Name)
}

错误:

Failed to open registry key -- Administrator permissions are needed to use
the selected options. Use an administrator command prompt to complete these tasks.

所以我创建了一个脚本来运行第一个脚本,但添加了 -elevated 参数。这没什么区别。

我还尝试使用命令提示符步骤而不是 powershell。这也返回了同样的错误。

For /r %g in ("Project.*.dll") DO sn -Vr %g

当我尝试对构建代理机器本身运行相同的脚本 rdp 时,它按预期工作。只有当它作为构建中的一个步骤运行时才不起作用。

有什么想法吗?

最佳答案

根据你的描述:

When I tried running this same script rdp'd to the build agent machine itself, it works as intended.

我假设您正在使用自己的构建代理进行构建。那么这可能是由于构建代理没有使用管理员帐户运行造成的。请更新您的构建代理以使用管理员帐户运行,然后重试。

Run the agent Run as a service

If you deployed the agent to run as a Windows service, then the agent running status can be controlled from the Services snap-in. Run services.msc and look for "VSO Agent ()". If you need to change the logon account, don't do it from the services snap-in. Instead, From an elevated Command Prompt, run: C:\Agent\Agent\VsoAgent.exe /ChangeWindowsServiceAccount Run interactively

Otherwise if you installed the agent to run interactively, the agent can be started by launching Agent\VsoAgent.exe.

详情请引用此链接:Run the agent

关于build - 在 Visual Studio Team Services 构建期间以管理员身份运行 Powershell 或命令提示符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36550343/

相关文章:

c# - Visual Studio clean 解决方案不会删除所有被移动的 dll/项目引用

scala - 如何使 sbt 任务使用特定的配置范围?

python - 使用 SCons 进行真正的分层构建?

swift - Xcode 10 新构建系统清理问题

android - 有没有办法让 Android NDK-build 使用更新版本的 gcc?

build - 是否有适用于多种语言的类似 Maven 的工具?

javascript - 内联 require.js 文本!使用咕噜声

msbuild - 为什么我的 .wpp.targets 文件没有应用到我的构建服务器上?

visual-studio-2010 - 极简 Qt 构建的推荐标志

java - 在行中找不到可执行代码